arcgis javascript api 4.14 添加天地图地图

1. 天地图管网申请 token 值,这个值添加在地址里。

注意:此处的token分两种,一种是桌面应用,一种浏览器引用。所以申请前请选择好类型。

http://lbs.tianditu.gov.cn/home.html

 

另外天地图的图层类型请参考 http://lbs.tianditu.gov.cn/server/MapService.html

 

2. 添加引用

 

 require([
            "esri/Map",
            "esri/views/MapView",
            "esri/layers/WebTileLayer"
        ], function (Map,
            MapView,
            WebTileLayer
        ) {
            var tiledLayer = new WebTileLayer({
                urlTemplate:
                "http://{subDomain}.tianditu.gov.cn/DataServer?T=vec_w&x={col}&y={row}&l={level}&tk=你申请的token值",
                subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
                copyright: "TDT"
            });
 
            var tiledLayer_poi = new WebTileLayer({
                urlTemplate:
                "http://{subDomain}.tianditu.gov.cn/DataServer?T=cva_w&x={col}&y={row}&l={level}&tk=你申请的token值",
                subDomains: ["t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7"],
                copyright: "TDT"
            });


            let map = new Map({
                basemap: {
                    baseLayers: [tiledLayer, tiledLayer_poi]
                },
                logo: false
            });

 

posted @ 2020-03-05 22:04  googlegis  阅读(1433)  评论(0编辑  收藏  举报

坐标合肥,非典型GIS开发人员 GitHub