看了官方的ArcGIS API for JavaScript开发教程,发现有些不太一样,在这里重新将部署步骤写一下。
以ArcGIS JSAPI 3.9为例,下载地址:http://support.esrichina.com.cn/2011/0223/960.html
1、将arcgis_js_v39_api复制粘贴到C:\inetpub\wwwroot
2、用记事本打开C:\Inetpub\wwwroot\arcgis_js_v39_api\arcgis_js_api\library\3.9\3.9\init.js,
替换[HOSTNAME_AND_PATH_TO_JSAPI]为localhost/arcgis_js_v39_api/arcgis_js_api/library/3.9/3.9/
3、用记事本打开C:\Inetpub\wwwroot\arcgis_js_v39_api\arcgis_js_api\library\3.9\3.9\js\dojo\dojo\dojo.js,
替换[HOSTNAME_AND_PATH_TO_JSAPI]为localhost/arcgis_js_v39_api/arcgis_js_api/library/3.9/3.9/
4、测试安装结果。新建一个html文件,将下面代码输入,浏览网页
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Simple Map</title>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_v39_api/arcgis_js_api/library/3.9/3.9/js/dojo/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_v39_api/arcgis_js_api/library/3.9/3.9/js/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost/arcgis_js_v39_api/arcgis_js_api/library/3.9/3.9/init.js"></script>
<script type="text/javascript">
dojo.require("esri.map");
function init() {
var myMap = new esri.Map("mapDiv");
//note that if you do not have public Internet access then you will need to point this url to your own locally accessible cached service.
var myTiledMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");
myMap.addLayer(myTiledMapServiceLayer);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<div id="mapDiv" style="width:900px; height:600px; border:1px solid #000;"></div>
</body>
</html>