arcgis api for javascript 學習(一) 調用在線發佈的動態地圖

一、圖中顯示爲arcgis軟件中顯示的地圖文件css

二、調用動態地圖主要的是知道動態地圖的URL地址html

三、經過IDE(webstorm)調用動態地圖,如圖web

四、話很少說,直接上代碼webstorm

<!DOCTYPE HTML>
<html>
<head>
    <title>調用動態地圖服務</title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link rel="stylesheet" href="https://js.arcgis.com/3.29/esri/css/esri.css">
    <script src="https://js.arcgis.com/3.29/"></script>
    <script>
        require([
            "esri/map",
            "esri/layers/ArcGISDynamicMapServiceLayer",
            "esri/layers/ArcGISTiledMapServiceLayer",
            "esri/geometry/Extent",
            "esri/SpatialReference"], function(
                Map,
                ArcGISDynamicMapServiceLayer,
                ArcGISTiledMapServiceLayer,
                Extent,
                SpatialReference
        ) {
            var extent = new Extent(71.010089,21.288148,135.768574,54.399626, new SpatialReference({ wkid:4326 }));
            var map = new Map("map", {
                //center: [116.403119,39.915599],
                //zoom:2,
                extent:extent,
                basemap: "streets" //satellite、streets、oceans
            });
            //調用動態地圖服務
            var dyLayer=new ArcGISDynamicMapServiceLayer('http://localhost:6080/arcgis/rest/services/mapservice/MapServer');
            map.addLayer(dyLayer);

        });
    </script>
</head>
<body>
<div id='map'>

</div>
</body>
</html>
相關文章
相關標籤/搜索