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)