2.arcGis底图切换

arcGis底图切换

html代码:

JS代码:

var map;
require([
    "esri/map",
    "esri/layers/ArcGISTiledMapServiceLayer"
],function(Map, ArcGISTiledMapServiceLayer){
    /*初始加载地图*/
    map = new Map("basemapchangeMap", {
        basemap: "satellite",
        center: [87.430157,43.899799],
        zoom: 10
    });
    $(".BasemapToggle-wrap>div>ul>li").click(function(){
        var toggleMap = $(this).attr("base-map-name");
        console.log(toggleMap);
        map.setBasemap(toggleMap);//该方法为主要方法
    });

    var layer = new ArcGISTiledMapServiceLayer("http://192.168.2.236:6080/arcgis/rest/services/JKQYXMapService/MapServer");
    map.addLayer(layer);
    var jwz=new ArcGISTiledMapServiceLayer('http://192.168.2.236:6080/arcgis/rest/services/jingwuzhan/MapServer');
    map.addLayer(jwz);
});

你可能感兴趣的:(arcgis)