Zookeeper
ArcGIS API for JavaScript (JavaScript API) is a set of scripts that ESRI uses to call ArcGIS Server rest api Interfaces Based on JavaScript technology. The latest Version is Version 3.8. Using ArcGIS API for JavaScript, You can embed the map resources provided by ArcGIS Server into a Web application. JavaScript APIs are based on the Dojo framework and use a large number of Dojo technologies. Therefore, to be familiar with API usage, you must first have a deep understanding of the Dojo framework!
I. Environment Introduction
(1) ArcGIS API for JavaScript 3.7: http://www.esri.com/apps/products/download/
(2) Eclipse 3.7 + Tomcat 7 + JDK 7
Ii. Setup steps
(1) create a dynamic project through Eclipse as follows:
Click Next:
Enter Project Name: ArcgisForJs, set Target runtime, and click Finish. The Project directory is as follows:
(2)Create the arcgis_js folder under the project WebContent
(3) decompress arcgis_js_v37_api.zip and copy the contents under arcgis_js_v37_api \ arcgis_js_api \ library \ 3.7 \ 3.7 compact to the arcgis_js folder.
(4) Modify arcgis_js \ init. js and arcgis_js \ js \ dojo. replace [HOSTNAME_AND_PATH_TO_JSAPI] With localhost: 8080/ArcgisForJs/arcgis_js/. Format: IP: web server port/project name/created folder arcgis_js
(5)Create the file index.html under WebContent with the following content:
My fisrt ArcGis Map <Script type = "text/javascript" src = "http: // localhost: 8080/ArcgisForJs/arcgis_js/init. js"> </script>
<Script type = "text/javascript"> Dojo. require ("esri. map "); Var myMap; Function init (){ MyMap = new esri. Map ("arcgisDiv "); Var myTiledMapServiceLayer = new esri. layers. ArcGISTiledMapServiceLayer ("http://cache1.arcgisonline.cn/arcgis/rest/services/ChinaOnlineCommunity/MapServer "); MyMap. addLayer (myTiledMapServiceLayer ); MyMap. setZoom (4 ); } Dojo. addOnLoad (init ); </Script>
|
(6) Deploy and run the project and access http: // localhost: 8080/ArcgisForJs/index.html. The effect is as follows: