`
huobengluantiao8
  • 浏览: 1029284 次
文章分类
社区版块
存档分类
最新评论

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服务,最终效果如下图:

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics