大家好,又见面了,我是你们的朋友全栈君。
目录
二,ArcGIS API For JavaScript3.17本地部署(IIS)
2.3 测试ArcGIS API For JavaScript函数库是否安装成功
3.3 测试ArcGIS API For JavaScript函数库是否安装成功
一,各版本下载地址
下载地址:https://developers.arcgis.com/downloads/apis-and-sdks?product=javascript
二,ArcGIS API For JavaScript3.17本地部署(IIS)
步骤:https://blog.csdn.net/lovecarpenter/article/details/52169705
安装大概需要3分钟。新建的Web文件夹我放在E盘了(E:\web)
2.1 修改相应的js文件(2个文件)
- 任意地方解压ArcGIS API For JavaScript3.17函数库
- 进入(arcgis_js_v317_api\arcgis_js_api\library\3.17),打开install_win.html页面,找到安装教程,如图所示:
修改 文件一(init.js)
位置:arcgis_js_v317_api\arcgis_js_api\library\3.17\3.17\init.js
将[HOSTNAME_AND_PATH_TO_JSAPI]替换成localhost/arcgis_js_api/library/3.17/3.17/
修改文件二(dojo.js)
位置:arcgis_js_v317_api\arcgis_js_api\library\3.17\3.17\dojo\dojo.js
将[HOSTNAME_AND_PATH_TO_JSAPI]替换成localhost/arcgis_js_api/library/3.17/3.17/
2.2 将修改好的函数库复制到指定位置
将arcgis_js_api(注意:不是arcgis_js_v317_api文件夹)文件夹移动到站点文件夹下面(E:\web),如图所示:
将这个文件夹:
移动到:
2.3 测试ArcGIS API For JavaScript函数库是否安装成功
- 在桌面新建一个test.html,将测试代码复制到test.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.17/3.17/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost/arcgis_js_api/library/3.17/3.17/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost/arcgis_js_api/library/3.17/3.17/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>
当你可以在test页面看到地图时,说明你的ArcGIS API 本地部署已经成功了。
三,Tomcat 部署
参考:https://blog.csdn.net/lovecarpenter/article/details/52165508
3.1 修改2个js文件
* 修改 文件一(init.js)
位置:arcgis_js_v317_api\arcgis_js_api\library\3.17\3.17\init.js
将[HOSTNAME_AND_PATH_TO_JSAPI]替换成localhost:8080/arcgis_js_api/library/3.17/3.17/
* 修改文件二(dojo.js)
位置:arcgis_js_v317_api\arcgis_js_api\library\3.17\3.17\dojo\dojo.js
将[HOSTNAME_AND_PATH_TO_JSAPI]替换成localhost:8080/arcgis_js_api/library/3.17/3.17/
3.2 将修改好的函数库复制到指定位置
将arcgis_js_api(注意:不是arcgis_js_v317_api文件夹)文件夹移动到tomcat安装目录的webapps目录下,如图所示:
将这个文件夹:
移动到:
3.3 测试ArcGIS API For JavaScript函数库是否安装成功
- 在桌面新建一个test.html,将测试代码复制到test.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:8080/arcgis_js_api/library/3.17/3.17/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://localhost:8080/arcgis_js_api/library/3.17/3.17/esri/css/esri.css" />
<script type="text/javascript" src="http://localhost:8080/arcgis_js_api/library/3.17/3.17/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>
运行:启动服务器(D:\apache-tomcat-v8.0.53\apache-tomcat-8.0.53\bin\startup.bat), 再打开test.html
当你可以在test页面看到地图时,说明你的ArcGIS API 本地部署已经成功了。
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/136395.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...