目录
一、API下载
下载地址:https://developers.arcgis.com/downloads/apis-and-sdks?product=javascript
二、启动IIS功能
点击这两个的复选框,确定之后,可以看到C盘下多出了inetpub文件夹
三、API离线部署
将下载下来的API和SDK文件夹内的4.16文件夹复制到inetpub下的wwwroot文件夹之下
修改下图所示的两个文件“init.js”和“dojo.js”,修改方法为将“init.js”及“dojo.js”文件中的https://[HOSTNAME_AND_PATH_TO_JSAPI]dojo修改为在本地的部署路径http://localhost/4.17API/dojo
四、验证离线部署
1.使用记事本创建名为test.html文件,并将其置于C:\inetpub\wwwroot\test文件夹下
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Intro to MapView - Create a 2D map</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="http://localhost/4.17API/esri/themes/light/main.css" />
<script src="http://localhost/4.17API/init.js"></script>
<script>
require(["esri/Map", "esri/views/MapView"], function(Map, MapView) {
var map = new Map({
basemap: "topo-vector"
});
var view = new MapView({
container: "viewDiv", // Reference to the view div created in step 5
map: map, // Reference to the map object created before the view
zoom: 4, // Sets zoom level based on level of detail (LOD)
center: [15, 65] // Sets center point of view using longitude,latitude
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>