官方文档 https://developers.arcgis.com/rest/services-reference/using-the-services-directory.htm
账号 jhm0611 密码 jhm061101714
API下载 https://developers.arcgis.com/downloads/apis-and-sdks?product=javascript&version=4.9
一:首先需要打开本地电脑服务 使用的是IIS,(页面调用需要,引用的css.js需要放到服务器上) 服务器打开步骤: https://jingyan.baidu.com/article/6dad5075031a16a123e36ee5.html
二:将 下载的api 放到C 盘 C/inetpub/wwwroot/下
IIS 项目部署步骤:https://jingyan.baidu.com/article/fedf073770f23335ac8977b1.html
三:下载 API 有多版本,尽量下载新版本 3.14 为正常构建 3.14compact 为紧凑版本,在 install.html中有安装与介绍
下载的api需要修改 2 个地方
1.C:\Inetpub\wwwroot\arcgis_js_api\library\3.14\3.14\init.js在文本编辑器中打开并搜索文本'[HOSTNAME_AND_PATH_TO_JSAPI]',并将其替换为"localhost:8080/arcgis_js_api/library/3.14/3.14/"
2.C:\Inetpub\wwwroot\arcgis_js_api\library\3.14\3.14\dojo\dojo.js在文本编辑器中打开并搜索文本'[HOSTNAME_AND_PATH_TO_JSAPI]',并将其替换为"localhost:8080/arcgis_js_api/library/3.14/3.14/"
四: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_api/library/3.14/3.14/dijit/themes/tundra/tundra.css"/> /
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.14/3.14/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.14/3.14/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>