<!--@author:pixie15
@url:http://my.csdn.net/pixie15 , http://download.csdn.net/user/pixie15
-->
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/dijit/themes/tundra/tundra.css">
<link rel="stylesheet" href="http://js.arcgis.com/3.14/esri/css/esri.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{ margin: 0; padding: 0; height:100%;}
/* center the image in the popup */
.esriViewPopup .gallery { margin: 0 auto !important; }
</style>
<script>
// helpful for understanding dojoConfig.packages vs. dojoConfig.paths:
// http://www.sitepen.com/blog/2013/06/20/dojo-faq-what-is-the-difference-packages-vs-paths-vs-aliases/
var dojoConfig = {
paths: {
extras: location.pathname.replace(/\/[^/]+$/, "") + "/extras"
}
};
</script>
<script src="http://js.arcgis.com/3.14/"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js" type="text/javascript"></script>
<script src="js/WebTile.js"></script>
<script>
var map;
require([
"esri/map", //地图
"esri/layers/WebTiledLayer" , //加载天地图
"dojo/parser",
"esri/request",
"dojo/domReady!"
], function(Map,WebTiledLayer,parser,
esriRequest){
// map = new Map("map");
console.log("我的下载频道:http://download.csdn.net/user/pixie15")
parser.parse();
//加载天地图
var tileInfo = new esri.layers.TileInfo(tileInfoObj);
var baseMap = new WebTiledLayer("http://\${subDomain}.tianditu.com/DataServer?T=vec_c&X=\${col}&Y=\${row}&L=\${level}", {
"copyright": "Tianditu",
"id": "Tianditu",
"subDomains": ["t0", "t1", "t2"],
"tileInfo":tileInfo
});
//底图标注
var baseMapMarker = new WebTiledLayer("http://\${subDomain}.tianditu.com/DataServer?T=cva_c&X=\${col}&Y=\${row}&L=\${level}", {
"copyright": "Tianditu",
"id": "Tianditu2",
"subDomains": ["t0", "t1", "t2"],
"tileInfo":tileInfo
});
map = new Map("map", {
// basemap: "streets",
center: [87, 43],
zoom: 13
});
// map = new Map("map", {logo:false,slider: true});
map.addLayer(baseMap,0);
map.addLayer(baseMapMarker,1);
setFirstCenter(116.409,39.899,9);
/*****************通过后台取数据来获得***********************/
//从后台获取中心点,json格式为:{"x":166.409,"y":39.899,"zoom",9}
/*var center = esriRequest({
url: "../showPoints.do?method=getFirstCenter",
handleAs: "json"
});
center.then(setFirstCenterFromBack, error);*/
/**
*从后台获取初始的中心点
*/
/*function setFirstCenterFromBack(resp){
setFirstCenter(resp.x,resp.y,resp.zoom);
}
function error(err) {
console.log("something failed: ", err);
}*/
/***********************************************************************/
});
/**
* 设置初始的x,y坐标及缩放比例
*/
function setFirstCenter(x,y,zoom){
map.centerAndZoom(new esri.geometry.Point({
"x": x,
"y": y,
"spatialReference": {
"wkid": 4326
}
}),zoom);
}
</script>
</head>
<body>
<div data-dojo-type="dijit/layout/BorderContainer"
data-dojo-props="design:'headline',gutters:false"
style="width: 100%; height: 90%; margin: 0;">
<div id="map"
data-dojo-type="dijit/layout/ContentPane"
data-dojo-props="region:'center'">
</div>
</div>
</body>
</html>
- 1
- 2
- 3
- 4
- 5
- 6
前往页