我的 首页
返回搜索

SuperMap学习系列(一)—加载地图(rest方式)

2016/7/21 14:48:24 0人评论 4208次浏览

SuperMap学习系列(一)—加载地图(rest方式)

[html] view plaincopy在CODE上查看代码片派生到我的代码片

  1. <!DOCTYPE html>  
  2. <html xmlns="<a target="_blank" href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>">  
  3. <head>  
  4.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />  
  5.     <title></title>  
  6.     <script src="json_parse.js"></script>  
  7.     <script src="toJSON.js"></script>  
  8.     <script src="libs/SuperMap.Include.js"></script>  
  9.     <script type="text/javascript">             
  10.         var map, layer, vectorLayer, control, selectFeature;  
  11.         // 设置访问的GIS服务地址  
  12.         var url = "<a target="_blank" href="http://localhost:8090/iserver/services/map-ChinaTestWorkPlace/rest/maps/ChinaTest">http://localhost:8090/iserver/services/map-ChinaTestWorkPlace/rest/maps/ChinaTest</a>";  
  13.         function GetMap() {  
  14.             // 创建地图对象  
  15.             map = new SuperMap.Map("map");  
  16.             //control = new SuperMap.Control.MousePosition();     //该控件显示鼠标移动时,所在点的地理坐标。  
  17.             //map.addControl(control);  //添加控件  
  18.             // 创建图层对象  
  19.             layer = new SuperMap.Layer.TiledDynamicRESTLayer("World", url, { transparent: true, cacheEnabled: true }, { maxResolution: "auto" });  
  20.             layer.events.on({ "layerInitialized": addLayer });              
  21.         }  
  22.         // 加载图层  
  23.         function addLayer() {  
  24.             // 向Map添加图层  
  25.             map.addLayer(layer);  
  26.             map.setCenter(new SuperMap.LonLat(116.409749, 39.912344), 1);           
  27.         }       
  28.     </script>  
  29. </head>  
  30. <body onload="GetMap()">      
  31.     <div id="map" style="height: 640px; width: 720px; border: 1px solid red; margin-left: auto; margin-right: auto;"></div>  
  32. </body>  
  33. </html>  

效果图如下:

相关资讯
    暂无相关...

栏目类别