ArcGIS API for JavaScript development environment setup and first instance demo
ESRI has released the latest ArcGIS Server for JavaScript API v3.9 so far, which provides richer and more powerful functions.
I. Preparations before installation
1. download the latest "ArcGIS Server for JavaScript API"
ArcGIS API for JavaScript 3.9: Library | SDK", As shown in:
2. Shows the local file to be downloaded:
3. decompress the above two zip packages, as shown in:
4. Make sure that IIS has been installed locally. If not, configure it by referring to the following address:
Http://jingyan.baidu.com/article/8275fc8694360146a03cf6c3.html
Ii. api and sdk local IIS configuration and deployment
1. Open the C: Inetpubwwwroot folder.
2. Copy the arcgis_js_v39_sdk folder to C: Inetpubwwwroot and change it to C: Inetpubwwwrootarcgis_js_v39_sdk,
As shown in:
3. Copy the library folder under the arcgis_js_v39_apiarcgis_js_api directory
C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_api
C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_apiLibrary, As shown in:
Open iisin 4、, and view install.htm, as shown in. It indicates that the initial deployment is successful:
5. Find C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_apilibrary.9.3.9init.jsFile, opened using notepad or EditPlus; Ctrl + F combination key search[HOSTNAME_AND_PATH_TO_JSAPI]And replace it /Arcgis_js_v39_sdk/arcgis_js_api/library/3.9/3.9 /, Where Is the machine name or machine IP address. Note that there is no http prefix. It can be localhost or 192.168.11.195. Here I use Localhost, As shown in:
6. Find C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_apilibrary.9.3.9jsdojodojodojo.jsFile, open it with notepad or EditPlus, and search by pressing Ctrl + F[HOSTNAME_AND_PATH_TO_JSAPI]And replace it /Arcgis_js_v39_sdk/arcgis_js_api/library/3.9/3.9/ , Where It is the machine name or machine IP address without the http prefix. It can be localhost or 192.168.11.195. Here I use Localhost, As shown in:
7. Find3.9 compactFolder, the operations in steps 8), 9) are the same as those in Steps 5) and 6), but the operations in steps 8) and 9) are for the 3.9compact folder, and 5) and 6) the operation is for the 3.9 folder, as shown in:
8. C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_apilibrary.9. 9compactinit. jsFile, which can be opened using notepad or EditPlus; Ctrl + F[HOSTNAME_AND_PATH_TO_JSAPI]And replace it /Arcgis_js_v39_sdk/arcgis_js_api/library/3.9/3.9 compact/ , Where Is the machine name or machine IP address. Note that there is no http prefix. It can be localhost or 192.168.11.195. Here I use Localhost, As shown in:
9. Find C: inetpubwwwrootarcgis_js_v39_sdkarcgis_js_apilibrary.9.3.9compactjsdojodojodojo.jsFile, open it with notepad or EditPlus, and search by pressing Ctrl + F[HOSTNAME_AND_PATH_TO_JSAPI]And replace it /Arcgis_js_v39_sdk/arcgis_js_api/library/3.9/ 3.9 compact/, Where It is the machine name or machine IP address without the http prefix. It can be localhost or 192.168.11.195. Here I use Localhost, As shown in:
10. After the preceding nine steps, we have completed the local deployment of ArcGIS API for JavaScript.
Iii. Run the instance demo
1. Create a blank webproject and an index.html file in vsvalidity. The file content is shown in:
The css and js files used here are the paths on the local server configured in the previous step.
<Script type = text/javascript src = http: // localhost/arcgis_js_v39_sdk/arcgis_js_api/library/3.9/3.9/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://cache1.arcgisonline.cn/ArcGIS/rest/services/ChinaOnlineCommunityENG/MapServer); myMap. addLayer (myTiledMapServiceLayer);} dojo. addOnLoad (init); </script>
2. Run the index.html page, as shown in: