<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no">
<title>Add WMTS Layer - Resource Info</title>
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map { padding:0; }
#citationInfo { position:absolute; color:black; font-weight:bold; font-size:12pt; left:10px; bottom:10px; z-Index:999; }
.layerMenu{
width: 100px;
height: 40px;
text-align:center;
font-family: "微软雅黑";
}
</style>
<link rel="stylesheet" href="http://tm.arcgisonline.cn:8038/App1/arcgis_js_v32_api/arcgis_js_api/library/3.2/jsapi/js/esri/css/esri.css">
<script>
var selfUrl = document.location.href.substring(0,document.location.href.lastIndexOf("/"));
var dojoConfig = { parseOnLoad: true,
mblHideAddressBar: false,
modulePaths: {"esrichina": selfUrl+"/js/esrichina" }
};
</script>
<script src="http://tm.arcgisonline.cn:8038/app1/arcgis_js_v32_api/arcgis_js_api/library/3.2/jsapicompact/init.js"></script>
<script>
dojo.require("esri.map");
dojo.require("esri.layers.wmts");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esrichina.TianDiTuLayer");
var map;
var baseLayer,annoLayer;
function init() {
esri.config.defaults.io.proxyUrl = "proxy.jsp";
intMap();
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_BASE_GCS);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_ANNO_GCS);
map.addLayer(baseLayer);
map.addLayer(annoLayer);
}
function intMap(){
map = new esri.Map("map");
}
//切换天地图类型
function switchMap(type){
if(map){
// map.destroy();
map = null;
dojo.byId("map").removeChild(dojo.byId("map_root"));
}
intMap();
/**
* 天地图类型:esrichina.TianDiTuLayer.XXXX,其中XXXX有以下值:
* VEC_BASE_GCS: 矢量底图(经纬度坐标系)
* VEC_ANNO_GCS: 矢量注记图层(经纬度坐标系)
* VEC_ANNO_GCS_EN: 矢量注记图层(经纬度坐标系)-英文注记
* VEC_BASE_WEBMERCATOR :矢量底图(web墨卡托)
* VEC_ANNO_WEBMERCATOR: 矢量注记图层((web墨卡托)
* VEC_ANNO_WEBMERCATOR_EN: 矢量注记图层((web墨卡托)-英文注记
*
* IMG_BASE_GCS: 影像底图(经纬度坐标系)
* IMG_ANNO_GCS: 影像注记图层(经纬度坐标系)
* IMG_ANNO_GCS_EN: 影像注记图层(经纬度坐标系) -英文注记
* IMG_BASE_WEBMERCATOR :影像底图(web墨卡托)
* IMG_ANNO_WEBMERCATOR: 影像注记图层((web墨卡托)
* IMG_ANNO_WEBMERCATOR_EN: 影像注记图层((web墨卡托)-英文注记
*
* TER_BASE_GCS: 地形底图(经纬度坐标系)
* TER_ANNO_GCS: 地形注记图层(经纬度坐标系)
* TER_BASE_WEBMERCATOR :地形底图(web墨卡托)
* TER_ANNO_WEBMERCATOR: 地形注记图层((web墨卡托)
*/
if(type == "VEC_GCS"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_BASE_GCS);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_ANNO_GCS);
}else if(type == "VEC_MER"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_BASE_WEBMERCATOR);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.VEC_ANNO_WEBMERCATOR);
}else if(type == "IMG_GCS"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.IMG_BASE_GCS);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.IMG_ANNO_GCS);
}else if(type == "IMG_MER"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.IMG_BASE_WEBMERCATOR);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.IMG_ANNO_WEBMERCATOR);
}else if(type == "TER_GCS"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.TER_BASE_GCS);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.TER_ANNO_GCS);
}else if(type == "TER_MER"){
baseLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.TER_BASE_WEBMERCATOR);
annoLayer = new esrichina.TianDiTuLayer(esrichina.TianDiTuLayer.TER_ANNO_WEBMERCATOR);
}else {
console.log("出错");
return;
}
map.addLayer(baseLayer);
map.addLayer(annoLayer);
}
dojo.ready(init);
</script>
</head>
<body>
<div data-dojo-type="dijit.layout.BorderContainer"
data-dojo-props="design:'headline', gutters:false"
style="width: 100%; height: 100%; margin: 0;">
<div id="map"
data-dojo-type="dijit.layout.ContentPane"
data-dojo-props="region:'center'">
</div>
<div id="mapList" style="position: absolute;top: 10px;right: 20px;">
<input type="button" class="layerMenu" value="矢量(经纬度)" onclick="switchMap('VEC_GCS')"/>
<input type="button" class="layerMenu" value="矢量(墨卡托)" onclick="switchMap('VEC_MER')"/>
<input type="button" class="layerMenu" value="影像(经纬度)" onclick="switchMap('IMG_GCS')"/>
<input type="button" class="layerMenu" value="影像(墨卡托)" onclick="switchMap('IMG_MER')"/>
<input type="button" class="layerMenu" value="地形(经纬度)" onclick="switchMap('TER_GCS')"/>
<input type="button" class="layerMenu" value="地形(墨卡托)" onclick="switchMap('TER_MER')"/>
</div>
</div>
</body>
</html>