Arcgis API for JavaScript learning Note-Preliminary attempt (3.2X version)

Source: Internet
Author: User

Arcgis API for JavaScript (3.22 version) official address: https://developers.arcgis.com/javascript/3/

1. Implement a simple map display function According to the official example.

Example code:

1 <!DOCTYPE HTML>2 <HTML>3 <Head>4     <Linkrel= "stylesheet"href= "Https://js.arcgis.com/3.22/esri/css/esri.css">5     <styletype= "Text/css">6 html, Body{margin:0;padding:0;Height:100%;width:100%; }7 #viewDiv{width:100%;Height:100%; }8     </style>9     <Scriptsrc= "https://js.arcgis.com/3.22/"></Script>Ten </Head> One <Body> A     <DivID= "Viewdiv"></Div> -     <Scripttype= "Text/javascript"> - require (["Esri/map", "dojo/domready!"], function(MAP) { the             varMap= NewMap ("Viewdiv", { -                 "Basemap": "Streets" -             }); -         }); +     </Script> - </Body> + </HTML>

Example:

2. Arcgis API for JavaScript offline deployment

Resource files on the referrer are usually slow to request and load, so it is better to deploy offline locally.

The first step: Download the ArcGIS JS API compression Package and unzip, if necessary, you can also download the ArcGIS JS SDK one copy. API is our development needs of the library, the SDK is a description of documents and examples;

Step two: Replace the domain name [HOSTNAME_AND_PATH_TO_JSAPI]

Locate the following two files and replace the "[Hostname_and_path_to_jsapi]" content in the file with the corresponding domain name (IP address: port)

D:\arcgis_js_api\arcgis_js_v320_api\library\3.20\3.20\init.js
D:\arcgis_js_api\arcgis_js_v320_api\library\3.20\3.20\dojo\dojo.js

After successful deployment, simply change the original CSS and JS file references to local addresses, as shown in:

1 <!DOCTYPE HTML>2 <HTML>3 <Head>4     <Linkrel= "stylesheet"href= "Http://localhost:8003/arcgis_js_v320_api/library/3.20/3.20/esri/css/esri.css">5     <styletype= "Text/css">6 html, Body{margin:0;padding:0;Height:100%;width:100%; }7 #viewDiv{width:100%;Height:100%; }8     </style>9 </Head>Ten <Body> One     <DivID= "Viewdiv"></Div> A     <Scriptsrc= "Http://localhost:8003/arcgis_js_v320_api/library/3.20/3.20/init.js"></Script> -     <Scripttype= "Text/javascript"> - require (["Esri/map", "dojo/domready!"], function(MAP) { the             varMap= NewMap ("Viewdiv", { -                 "Basemap": "Streets" -             }); -         }); +     </Script> - </Body> + </HTML>

Arcgis API for JavaScript learning Note-Preliminary attempt (3.2X version)

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.