arcgis for js 3.x 图层加载(wmts切片,动态加载)
适合arcgis for js 3.x 版本
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>天地图底图加载(经纬度版本)</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.40/esri/css/esri.css">
<script src="https://js.arcgis.com/3.40/"></script>
</head>
<body>
<div id="map-container" style="width: 600px;height: 600px;"></div>
<script type="text/javascript">
// ==========================================
// 测试版本:V3.11 - V3.x
// ==========================================
require(['esri/map',
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/layers/ImageParameters",
'dojo/domReady!'
],
function(EsriMap,
ArcGISDynamicMapServiceLayer,
ArcGISTiledMapServiceLayer,
ImageParameters
) {
// 创建地图,不设置底图,如果设置底图会造成坐标系无法被转换成 ESPG:4326 (WGS1984)
var map = new EsriMap('map-container', {
center: [113, 23],
zoom: 10
})
var imageParameters = new ImageParameters();
imageParameters.layerIds = [0, 24]; //图层
imageParameters.layerOption = ImageParameters.LAYER_OPTION_SHOW;
imageParameters.transparent = true;
var layerDefs = [];
var name = "济宁市"
layerDefs[24] = "XZQMC ='" + name + "'";
//动态加载
var imagelyr = new ArcGISDynamicMapServiceLayer(
"http://www.sdmap.gov.cn/tileservice/SDPubMap/MapServer", {
"imageParameters": imageParameters,
id: "dyn"
});
map.addLayer(imagelyr);
//切片加载
var tiledlyr = new ArcGISTiledMapServiceLayer("http://www.sdmap.gov.cn/tileservice/SDPubMap/MapServer");
map.addLayer(tiledlyr);
})
</script>
</body>
</html>