ArcGIS JavaScript API 3.11本地化安装
1、下载API
美国站点:http://www.esri.com/apps/products/download/index.cfm?fuseaction=download.all#ArcGIS_API_for_JavaScript
中国ESRI网站:http://support.esrichina-bj.cn/support/download/software/
2、安装
下载完毕后,解压Library:arcgis_js_v311_api.zip和SDK:arcgis_js_v311_sdk.zip,将文件夹arcgis_js_api(里面包含Library和SDK)都拷贝到D:\Program Files\Java\apache-tomcat-7.0.55\webapps目录下
3、配置正常版安装(arcgis)
(1)打开D:\Program Files\Java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11\init.js文件,用记事本替换文本 “[HOSTNAME_AND_PATH_TO_JSAPI]”为“xjuLab:8080/arcgis_js_api/library/3.11/3.11/”。
注意:<myserver>可填写主机名或主机IP地址,若使用的私有地址或在网络上部署,必须填写IP地址。
(2)打开D:\Program Files\Java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11\js\dojo\dojo\dojo.js文件,用记事本替换所有文本“[HOSTNAME_AND_PATH_TO_JSAPI]”为“xjuLab:8080/arcgis_js_api/library/3.11/3.11/”。
4、配置压缩版安装(arcgis_compact)
打开D:\Program Files\Java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11compact\init.js文件,用记事本替换文本 “[HOSTNAME_AND_PATH_TO_JSAPI]”为“xjuLab:8080/arcgis_js_api/library/3.11/3.11compact/”。
打开D:\Program Files\Java\apache-tomcat-7.0.55\webapps\arcgis_js_api\library\3.11\3.11compact\js\dojo\dojo\dojo.js文件,用记事本替换文本 “[HOSTNAME_AND_PATH_TO_JSAPI]”为“xjuLab:8080/arcgis_js_api/library/3.11/3.11compact/”。
5、测试安装
http://xjuLab:8080/arcgis_js_api/library/3.11/3.11compact/init.js
http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/init.js
6、建一个测试页面,运行查看结果
<!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://xjuLab:8080/arcgis_js_api/library/3.11/3.11/dijit/themes/tundra/tundra.css"/>
<link rel="stylesheet" type="text/css" href="http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/esri/css/esri.css" />
<script type="text/javascript" src="http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/init.js"></script>
<script type="text/javascript">
dojo.require("esri.map");
function init() {
var myMap = new esri.Map("mapDiv");
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>
7、配置ArcGIS Services路径中的"View In JavaScript" 使用本地JS
打开D:\Program Files\ArcGIS\Server\framework\runtime\tomcat\webapps\arcgis#rest\WEB-INF\classes\resources\rest-config.properties文件,修改内容如下:
#JS API URLs
jsapi.arcgis=http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/
jsapi.arcgis.sdk=http://xjuLab:8080/arcgis_js_sdk/sdk/
jsapi.arcgis.css=http://xjuLab:8080/arcgis_js_api/library/3.11/3.11/js/dojo/dijit/themes/tundra/tundra.css
备注:可以修改ArcGIS.com URL,参考网址http://resources.arcgis.com/en/help/rest/apiref/index.html?config.html
本文出自 “IT技术学习与交流” 博客,谢绝转载!
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。