36ArcGIS API for JavaScript3.X 系列加载天地图(经纬度)
1 <!DOCTYPE html> 2 <html> 3 4 <head> 5 <meta charset="utf-8"> 6 <title>3.X版本加载天地图(经纬度)</title> 7 <link rel="stylesheet" href="https://js.arcgis.com/3.28/esri/css/esri.css"> 8 <script src="https://js.arcgis.com/3.28/"></script> 9 </head> 10 <!-- 3.21-3.28通用 --> 11 <style> 12 html, 13 body, 14 #mapDiv { 15 width: 100%; 16 height: 100%; 17 margin: 0; 18 padding: 0; 19 } 20 </style> 21 <script> 22 require(['esri/map', 23 'esri/layers/WebTiledLayer', 24 'esri/layers/TileInfo', 25 'esri/geometry/Point', 26 "esri/dijit/OverviewMap", 27 'dojo/domReady!'], function (Map, WebTiledLayer, TileInfo, Point, OverviewMap) { 28 var map = new Map('mapDiv', { 29 center: [0, 0], 30 zoom: 0 31 }) 32 var tileInfo = new TileInfo({ 33 dpi: 90.71428571427429, 34 rows: 256, 35 cols: 256, 36 compressionQuality: 0, 37 origin: { 38 x: -180, 39 y: 90 40 }, 41 spatialReference: { 42 wkid: 4326 43 }, 44 lods: [ 45 { level: 2, levelValue: 2, resolution: 0.3515625, scale: 147748796.52937502 }, 46 { level: 3, levelValue: 3, resolution: 0.17578125, scale: 73874398.264687508 }, 47 { level: 4, levelValue: 4, resolution: 0.087890625, scale: 36937199.132343754 }, 48 { level: 5, levelValue: 5, resolution: 0.0439453125, scale: 18468599.566171877 }, 49 { level: 6, levelValue: 6, resolution: 0.02197265625, scale: 9234299.7830859385 }, 50 { level: 7, levelValue: 7, resolution: 0.010986328125, scale: 4617149.8915429693 }, 51 { level: 8, levelValue: 8, resolution: 0.0054931640625, scale: 2308574.9457714846 }, 52 { level: 9, levelValue: 9, resolution: 0.00274658203125, scale: 1154287.4728857423 }, 53 { level: 10, levelValue: 10, resolution: 0.001373291015625, scale: 577143.73644287116 }, 54 { level: 11, levelValue: 11, resolution: 0.0006866455078125, scale: 288571.86822143558 }, 55 { level: 12, levelValue: 12, resolution: 0.00034332275390625, scale: 144285.93411071779 }, 56 { level: 13, levelValue: 13, resolution: 0.000171661376953125, scale: 72142.967055358895 }, 57 { level: 14, levelValue: 14, resolution: 8.58306884765625e-005, scale: 36071.483527679447 }, 58 { level: 15, levelValue: 15, resolution: 4.291534423828125e-005, scale: 18035.741763839724 }, 59 { level: 16, levelValue: 16, resolution: 2.1457672119140625e-005, scale: 9017.8708819198619 }, 60 { level: 17, levelValue: 17, resolution: 1.0728836059570313e-005, scale: 4508.9354409599309 }, 61 { level: 18, levelValue: 18, resolution: 5.3644180297851563e-006, scale: 2254.4677204799655 }, 62 { level: 19, levelValue: 19, resolution: 2.68220901489257815e-006, scale: 1127.23386023998275 }, 63 { level: 20, levelValue: 2, resolution: 1.341104507446289075e-006, scale: 563.616930119991375 } 64 ] 65 }) 66 var vecLayer = WebTiledLayer('http://{subDomain}.tianditu.com/DataServer?T=vec_c&x={col}&y={row}&l={level}&tk=你申请的tk', { 67 subDomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'], 68 tileInfo: tileInfo 69 }) 70 // 矢量地图 71 var labelLayer = WebTiledLayer('http://{subDomain}.tianditu.com/DataServer?T=cva_c&x={col}&y={row}&l={level}&tk=你申请的tk', { 72 subDomains: ['t0', 't1', 't2', 't3', 't4', 't5', 't6', 't7'], 73 tileInfo: tileInfo 74 }) 75 // 矢量注记图层 76 map.addLayers([vecLayer, labelLayer]) 77 map.centerAndZoom(new Point({ 78 x: 109, 79 y: 34.5, 80 spatialReference: { 81 wkid: 4326 82 } 83 }), 3) 84 var overviewMapDijit = new OverviewMap({ 85 map: map, 86 visible: true 87 }); 88 overviewMapDijit.startup();//鹰眼 89 }) 90 </script> 91 92 <body> 93 <div id="mapDiv"></div> 94 </body> 95 96 </html>