ArcGIS For JavaScript API 添加 world imagery(世界图像)————(五)

描述:

           此示例显示如何添加到您的应用程序世界图像

          这里使用了2个ArcGISTiledMapServiceLayer服务相互叠加显示的效果,世界地图。

 

演示链接地址:http://help.arcgis.com/en/webapi/javascript/arcgis/samples/map_imagery/index.html

具体的方法,属性和参数请参考API:http://help.arcgis.com/en/webapi/javascript/arcgis/index.html

 

代码如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
    <!--The viewport meta tag is used to improve the presentation and behavior of the samples on iOS devices-->
    <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
    <title>Imagery</title>
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/dojo/dijit/themes/claro/claro.css">
    <link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.2/js/esri/css/esri.css" />
    <style>
      html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
      #map{padding:0;}
    </style>
    <script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
    <script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.2"></script>
    <script type="text/javascript">
      dojo.require("dijit.layout.BorderContainer");
      dojo.require("dijit.layout.ContentPane");
      dojo.require("esri.map");
      var map;
      function init() {
        var initExtent = new esri.geometry.Extent({"xmin":-13618161,"ymin":5892040,"xmax":-13450611,"ymax":5962515,"spatialReference":{"wkid":102100}});
        map = new esri.Map("map",{extent:initExtent});
        
        //将世界的图像添加到地图中。
        var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer");
        map.addLayer(basemap);
        
        var referenceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer");
        map.addLayer(referenceLayer);
  
        dojo.connect(map, 'onLoad', function(theMap) {
          //地图随浏览器大小调整
          dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
        });
      }

      dojo.addOnLoad(init);	// 初始化加载
    </script>
  </head>
  <body class="claro">
    <div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width: 100%; height: 100%; margin: 0;">
      <div id="map" dojotype="dijit.layout.ContentPane" region="center" style="overflow:hidden;">
      </div>
    </div>
  </body>
</html>

服务的显示效果如下 http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer

 ArcGIS For JavaScript API 添加 world imagery(世界图像)————(五)_第1张图片

 http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer

ArcGIS For JavaScript API 添加 world imagery(世界图像)————(五)_第2张图片

 

最终效果:

ArcGIS For JavaScript API 添加 world imagery(世界图像)————(五)_第3张图片

 

 

 

你可能感兴趣的:(ARCGIS二次开发)