ArcGis API for JavaScript学习——加载地图

ArcGis API for JavaScript开发笔记——加载地图

在这个例子中使用的离线部署的API(请参见 
http://note.youdao.com/noteshare?id=f4286530e101e38b39ac26299ded3bd3&sub=wcp148109601207156)。 
新建一个html文件,如newmap.html。输入如下内容:

<!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>Simple Map</title>
<link rel="stylesheet" type="text/css"
href="http://localhost/arcgis_js_api/library/3.18/3.18/dijit/themes/tundra/tundra.css"/>
<script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.18/3.18/init.js"></script>
<link rel="stylesheet" type="text/css"
href="http://localhost/arcgis_js_api/library/3.18/3.18/esri/css/esri.css" />
<style>
html, body, #map {
height: 100%;
margin: 0;
padding: 0;
}
</style> <script>
var map;
require(["esri/map", "dojo/domReady!"], function(Map) {
map = new Map("map", {
zoom: 4
});
//URL为自定义发布的地图服务,请参见《ArcGis API for JavaScript开发笔记——发布服务.note》
var myDynamicMapServiceLayer=new esri.layers.ArcGISDynamicMapServiceLayer(
"http://localhost:6080/arcgis/rest/services//USAmap/MapServer");
map.addLayer(myDynamicMapServiceLayer);
});
</script>
</head> <body>
<div id="map"></div>
</body>
</html>

双击newmap.html在浏览器上运行,出现地图即加载成功。 
ArcGis API for JavaScript学习——加载地图

 
上一篇:arcgis中加载google在线地图


下一篇:ArcGIS API for Silverlight学习笔记