ArcGISJavaScriptAPI3.11本地化安裝

技術小胖子發表於2017-11-02

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 FilesJavaapache-tomcat-7.0.55webapps目錄下

3、配置正常版安裝(arcgis)

(1)開啟D:Program FilesJavaapache-tomcat-7.0.55webappsarcgis_js_apilibrary3.113.11init.js檔案,用記事本替換文字  “[HOSTNAME_AND_PATH_TO_JSAPI]”為“xjuLab:8080/arcgis_js_api/library/3.11/3.11/”。

注意:<myserver>可填寫主機名或主機IP地址,若使用的私有地址或在網路上部署,必須填寫IP地址。

(2)開啟D:Program FilesJavaapache-tomcat-7.0.55webappsarcgis_js_apilibrary3.113.11jsdojodojodojo.js檔案,用記事本替換所有文字“[HOSTNAME_AND_PATH_TO_JSAPI]”為“xjuLab:8080/arcgis_js_api/library/3.11/3.11/”。

4、配置壓縮版安裝(arcgis_compact)

開啟D:Program FilesJavaapache-tomcat-7.0.55webappsarcgis_js_apilibrary3.113.11compactinit.js檔案,用記事本替換文字  “[HOSTNAME_AND_PATH_TO_JSAPI]”為“xjuLab:8080/arcgis_js_api/library/3.11/3.11compact/”。

開啟D:Program FilesJavaapache-tomcat-7.0.55webappsarcgis_js_apilibrary3.113.11compactjsdojodojodojo.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 FilesArcGISServerframework
untime omcatwebappsarcgis#restWEB-INFclasses
esources
est-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



     本文轉自stock0991 51CTO部落格,原文連結:http://blog.51cto.com/qing0991/1564513,如需轉載請自行聯絡原作者




相關文章