Arcis API for JS value 3.17 Local Deployment

Source: Internet
Author: User

1. Introduction

In the process of learning the ArcGIS API, if we reference the online API, in the absence of network or network poor, will affect our learning efficiency, this article is to solve this problem. After downloading the ArcGIS API, deploying locally will greatly improve the user experience.

2. Steps

Before the deployment, we want to download the API, here I share the next version of the API, you need to download, extract code forajx1

Deploy the files locally and then through HTTP, which requires that the machine be treated as a server, and the following two methods are deployed via different servers (ISS and Tomcat).

2.1 ISS Deployment 2.1.1 Open ISS feature

Operate in the following order: Open Control Panel-programs-turn Windows features on or off, here are some features that you need to open. Click OK and wait to open.



Note When the ISS feature is turned on, we will find that there is a Inetpub folder under the C drive (if it is configured by default). The wwwroot of the Inetpub folder is the root directory of our service.

If we put a thst.html file under the Wwroot folder, then the access path is http://localhost/test.html

2.1.2 Modifying Dojo.js and Init.js files

Unzip the download good API compressed package, there is a install_api.html file, we modify these two files are mainly based on this file, open after clicking on Windows, jump to Windows configuration page.

Although the HTML file is in English, we just have to find the information we need.

Based on the above hints, we found [Hostname_and_path_to_jsapi] in the init.js and dojo.js files, and changed to: http://localhost/..., the path added after localhost ensures access to the Init.js file.

For example my init.js file is in this path: C:\inetpub\wwwroot\arcgis_js_api_v320\library\3.20\3.20\init.js, then I should say the above configuration is changed to/HTTP localhost/arcgis_js_api_v320/library/3.20/3.20.
The next three configurations, like this one, are no longer expanded.

2.1.3 Testing whether the deployment was successful

Follow the above configuration to make sure that you enter http://localhost/arcgis_js_api_v320/library/3.20/3.20compact/init.js in the browser window, if you have access to the Init.js file. Different URLs should be entered depending on the deployment environment.

Then the following code is placed in an HTML file, if you can see the following screen, the API deployment is successful.

Note You need to change the address of the two link tag and the file that is linked to a script tag below.

<! DOCTYPEHTML PUBLIC "-//w3c//dtd HTML 4.01//en" "HTTP://WWW.W3.ORG/TR/HTML4/STRICT.DTD">      <metahttp-equiv="Content-type"content="text/html; Charset=utf-8 "/>    <title>Simple Map</title>    <linkrel="stylesheet"type="Text/css"href="Http://localhost/arcgis_js_api_v320/library/3.20/3.20/dijit/themes/tundra/tundra.css"/>    <linkrel="stylesheet"type="Text/css"href="Http://localhost/arcgis_js_api_v320/library/3.20/3.20/esri/css/esri.css" />    <scripttype="Text/javascript"src="Http://localhost/arcgis_js_api_v320/library/3.20/3.20/init.js"></script>    <scripttype="Text/javascript">      Dojo.require("Esri.map");      function Init(){        varMyMap= New ESRI.Map("Mapdiv");        varMytiledmapservicelayer= New ESRI.Layers.Arcgistiledmapservicelayer("Http://server.arcgisonline.com/ArcGIS/rest/services/NGS_Topo_US_2D/MapServer");        MyMap.AddLayer(Mytiledmapservicelayer);      }      Dojo.Addonload(init);    </script>>  <Bodyclass="Tundra">    <Div ID="Mapdiv"Style="width:900px; height:600px; border:1px solid #000; "></div></body></html>

2.2 Tomcat Deployment

With the experience of deploying in an ISS environment, the TOMCAT deployment is essentially the same. Here's where you'll find the next idea:

When modifying the Init.js and dojo.js files, you need to modify the path to http://localhost:8080/, which represents the WebApps folder for Tomcat, and when the test deployment succeeds, the three links in the HTML file are modified to the corresponding path. Can

Arcis API for JS value 3.17 Local Deployment

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.