使用产品 iserver for client 9D 操作系统win10 x64
问题的详细描述:在浏览器中加载并显示地图。
代码如下:
<!DOCTYPE html>
<head>
<meta charset="UTF-8">
<title>Document</title>
<script src="lib/SuperMap.Include.js"></script>
<script type="text/javascript">
var map,layer, url = "http://localhost:8090/iserver/services/map-nanyou/rest/maps/d70d14a3_62d5_450d_9ec4_ae0ca836dc8c_1@%E5%8D%97%E9%82%AE";
function onPageLoad(){
map = new SuperMap.Map("map");
layer = new SuperMap.Layer.TiledDynamicRESTLayer("World",url,{transparent:true,cacheEnabled:true},{maxResolution:"auto"});
layer.events.on({"layerlnitialized":addLayer});
}
function addLayer(){
map.addLayer(layer);
map.setCenter(new SuperMap.Lonlat(0,0),0);
}
function ZoomIn(){
map.zoomIn();
}
function ZoomOut(){
map.zoomOut();
}
</script>
</head>
<body onload=onPageLoad()>
<div id="map" style="position: absolute; left: 0px; right:0px; width: 800px; height: 500px;">
</div>
<input type="button" value="选择站点" onclick="ZoomIn()">
<input type="button" value="提交" onclick="ZoomOut()">
<input type="button" value="清除" onclick="ZoomOut()">
</body>
</html>