本篇主要介绍利用ArcGIS API for Javascript添加显示高德在线地图的代码,基本方法说明这里不再赘余,直接贴上代码,以高德矢量街道图为例。
加载高德地图的效果图:
【1】矢量图
【2】影像图
相关代码
自定义高德矢量地图图层GaodeLayer:
define(["dojo/_base/declare", "esri/geometry/Extent", "esri/SpatialReference", "esri/geometry/Point", "esri/layers/TileInfo", "esri/layers/TiledMapServiceLayer"],
function (declare, Extent, SpatialReference, Point, TileInfo, TiledMapServiceLayer) {
return declare("gaodeLayer", TiledMapServiceLayer, {
// 构造函数
constructor: function (args) {
// 这里使用坐标系为投影坐标系WGS_1984_Web_Mercator_Auxiliary_Sphere(wkid: 3857)
this.spatialReference = new SpatialReference({
wkid: 3857
});
// 图层提供的起始显示范围和整个图层的地理范围
this.fullExtent = new Extent(-20037508.342787, -20037508.342787, 20037508.342787, 20037508.342787, this.spatialReference);
this.initialExtent = this.fullExtent;
this.tileInfo = new TileInfo({
"cols": 256,
"rows"