首页 » GIS技术开发 » 正文

arcgis通过TiledMapServiceLayer调用第瓦片地图数据

第一步重写ArcGIS的TiledMapServiceLayer调用天地图瓦片

*注意:需要知道瓦片数据的分辨了和中心点等配置参数
url的参数根据瓦片数据实际情况自行替换

function initClassname()
{
dojo.declare(“Classname”, [esri.layers.TiledMapServiceLayer], {
serviceUrl:null,
constructor: function (serviceUrl) {
this.serviceUrl=serviceUrl;
this.spatialReference = new esri.SpatialReference({ wkid: 2436 });
this.initialExtent = (this.fullExtent = new esri.geometry.Extent(420191.531274, 251025.152506, 600057.955041, 436695.613138, this.spatialReference));
this.tileInfo = new esri.layers.TileInfo({
“rows”: 256,
“cols”: 256,
“origin”: {
“x”: -5123300,
“y”: 10002300
},
“spatialReference”: {
“wkid”: 2436
},”lods”: [{
“level”: 0,
“scale”: 3386781.496062992,
“resolution”: 896.0859375
}, {
“level”: 1,
“scale”: 1693390.748031496,
“resolution”: 448.0429688
}, {
“level”: 2,
“scale”: 846695.374015748,
“resolution”: 224.021484375
}, {
“level”: 3,
“scale”: 423347.687007874,
“resolution”: 112.0107421875
}, {
“level”: 4,
“scale”: 211673.843503937,
“resolution”: 56.00537109375
}, {
“level”: 5,
“scale”: 105836.9217519685,
“resolution”: 28.002685546875
}, {
“level”: 6,
“scale”: 52918.46087598425,
“resolution”: 14.0013427734375
}, {
“level”: 7,
“scale”: 26459.23043799213,
“resolution”: 7.00067138671875
}, {
“level”: 8,
“scale”: 13229.61521899604,
“resolution”: 3.50033569335937
}
]
});
this.loaded = true;
this.onLoad(this);
},
getTileUrl: function (level, row, col) {
var url = “SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&Layer=BJVectorMap&TileMatrixSet=EPSG:2436_BJVectorMap&Format=image/png&TileMatrix=EPSG:2436_BJVectorMap:”+level+”&TileCol=”+col +”&TileRow=”+row+”&key=gw123456&mgsgin=f2cff2bbb126c51b4456172e9c91f2ae”;
var string =this.serviceUrl+ “?”+url;
return string;
}
});
}

发表评论