ArcGIS API for Javascript Application Development

Source: Internet
Author: User

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:






Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.