ArcGIS Server10.1 Javascript API的本地部署

用户在使用server的时候可能会发现在REST地址中的javascript方式浏览地图,需要计算在联网的情况下才能使用,原因是调用了在线的javascript API导致的,接下来我们来看如何让server使用本地的API。

首先下载JS API:http://www.esri.com/apps/products/download/index.cfm?fuseaction=download.all#ArcGIS_API_for_JavaScript,安装安装文档要求完成API配置。

Copy \arcgis_js_api\library and all its contents from the DVD to your Web server. In this example the files are copied to

C:\Inetpub\wwwroot\arcgis_js_api\library

Configuration options for normal build:

  1. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapi\init.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.0/jsapi/"
  2. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapi\js\dojo\dojo\dojo.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.0/jsapi/"
  3. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapi\js\dojo\dojo\dojo.js.uncompressed.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.0/jsapi/"

Configuration options for compact build:

  1. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapicompact\init.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace each instance of this text with "<myserver>/arcgis_js_api/library/3.0/jsapicompact/"
  2. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapi\js\dojo\dojo\dojo.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.0/jsapicompact/"
  3. Open C:\Inetpub\wwwroot\arcgis_js_api\library\3.0\jsapi\js\dojo\dojo\dojo.js.uncompressed.js in a text editor and search for the text '[HOSTNAME_AND_PATH_TO_JSAPI]', and replace this text with "<myserver>/arcgis_js_api/library/3.0/jsapicompact/"

在IIS中需要配置默认文档:Use Default.ashx for IIS, index.jsp for a Java Application server (such as Tomcat), or index.php for a php application server

完成后可以通过如下地址测试http://<myserver>/arcgis_js_api/library/3.0/jsapi/ and http://<myserver>/arcgis_js_api/library/3.0/jsapicompact/

接下来就是配置server的关键步骤,修改<serverinstalldir>\Server\framework\runtime\tomcat\webapps\arcgis#rest\WEB-INF\classes\resources\rest-config.properties 如下:

参数名称:jsapi.arcgis
原始值:http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.6
替换值:http://myserver/arcgis_js_api/library/3.0/jsapi

参数名称:jsapi.arcgis.css
原始值:http://serverapi.arcgisonline.com/jsapi/arcgis/2.6/js/dojo/dijit/themes/tundra/tundra.css
替换值:http://myserver/arcgis_js_api/library/3.0/jsapi/js/dojo/dijit/themes/tundra/tundra.css

完成配置后重启server服务,最终效果如下图:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值