ARCGISServer加载切片地图
首先切片地图要用松散型的切片格式,切片切好了之后放在IIS里面
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Portland Tile Server</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.15/dijit/themes/claro/claro.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.15/esri/css/esri.css">
<script src="https://js.arcgis.com/3.15/"></script>
<script>
dojo.require("esri.map");
function init() {
initLayer();
var map = new esri.Map("map");
map.addLayer(new my.PortlandTiledMapServiceLayer());
}
function initLayer(){
dojo.declare("my.PortlandTiledMapServiceLayer", esri.layers.TiledMapServiceLayer, {
constructor: function() {
this.spatialReference = new esri.SpatialReference({ wkid:4326 });
this.initialExtent = (this.fullExtent = new esri.geometry.Extent(70.401864176535653, 0.60296087810721177, 138.26303468455822, 56.325892345190738, this.spatialReference));
this.tileInfo = new esri.layers.TileInfo({
"rows": 256,
"cols": 256,
"dpi": 96,
"format": "PNG32",
"compressionQuality": 0,
"origin": {
"x": -400,
"y": 400
},
"spatialReference": { wkid: 4326 },
"lods": [
{ "level": 0, "resolution": 0.014276766034981677, "scale": 6000000 },
{ "level": 1, "resolution": 0.0095178440233211186, "scale": 4000000 },
{ "level": 2, "resolution": 0.0047589220116605593, "scale": 2000000 },
{ "level": 3, "resolution": 0.0023794610058302797, "scale": 1000000 },
{ "level": 4, "resolution": 0.0011897305029151398, "scale": 500000 },
{ "level": 5, "resolution": 0.00059486525145756991, "scale": 250000 },
{ "level": 6, "resolution": 0.00029743262572878496, "scale": 125000 },
{ "level": 7, "resolution": 0.00014276766034981676, "scale": 60000 }
]
});
this.loaded = true;
this.onLoad(this);
},
getTileUrl: function(level, row, col) {
return "http://localhost/WYFoo/Layers/_alllayers/" +
"L" + dojo.string.pad(level, 2, '0') + "/" +
"R" + dojo.string.pad(row.toString(16), 8, '0') + "/" +
"C" + dojo.string.pad(col.toString(16), 8, '0') + "." +
"png";
}
});
}
dojo.ready(init);
</script>
</head>
<body>
<div id="map" class="claro" style="width:768px; height:512px; border:1px solid #000;"></div>
</body>
</html>
根据发布切片时的XML文件或者发布切片的那个地图服务来更改切片的参数。
附上Arcgis官方地址,https://developers.arcgis.com/javascript/jssamples/layers_custom_tiled.html
转载自:https://blog.csdn.net/xiongxiongdeBear/article/details/46933477