Table of Contents
Installing the ArcGIS API for JavaScript Library on Linux
The instructions below assume that you are installing the ArcGIS JavaScript API library in the following location on an Apache Tomcat Web Server, http://fqdn.tld:8080/arcgis_js_api/library/4.0/ where fqdn.tld is the combination of the fully qualified domain name and top level domain of your web site with 8080 as the default web server port. This port number, of course, can be changed for your instance if you choose to not use this default port. After copying files to your web server, you will need to edit some files to include the URL to the server and the target installation directory.
If you are using a Windows operating system, please follow the link for instructions on deploying the library on Internet Information Services (IIS) for Windows® Server.
- Copy
\arcgis_js_api\libraryand all its contents from the DVD to your web server. In this example the files are copied to:$apache_tomcat_home/webapps/arcgis_js_api/library
Install the Build
- Open
$apache_tomcat_home\webapps\arcgis_js_api\library\4.0\4.0\init.jsin a text editor and search for the text[HOSTNAME_AND_PATH_TO_JSAPI], and replace this text withfqdn.tld:8080/arcgis_js_api/library/4.0/4.0/ - Open
$apache_tomcat_home\webapps\arcgis_js_api\library\4.0\4.0\dojo\dojo.jsin a text editor and search for the text[HOSTNAME_AND_PATH_TO_JSAPI], and replace this text withfqdn.tld:8080/arcgis_js_api/library/4.0/4.0/
Test the Install
Now you should be able to access the ArcGIS API for JavaScript library from your web server using the following URL:
<script src="http://www.example.com/arcgis_js_api/library/4.0/4.0/init.js"></script>
Test your install. You can use the following test code to validate your JSAPI library install.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Test Map</title>
<link rel="stylesheet" href="http://www.example.com/arcgis_js_api/library/4.0/4.0/dijit/themes/claro/claro.css" />
<link rel="stylesheet" href="http://www.example.com/arcgis_js_api/library/4.0/4.0/esri/css/main.css" />
<style>
html, body, #ui-map-view {
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
</style>
<script src="http://www.example.com/arcgis_js_api/library/4.0/4.0/init.js"></script>
<script>
var myMap, view;
require([
"esri/Basemap",
"esri/layers/TileLayer",
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function (Basemap, TileLayer, Map, MapView){
// --------------------------------------------------------------------
// If you do not have public Internet access then use the Basemap class
// and point this URL to your own locally accessible cached service.
//
// Otherwise you can just use one of the named hosted ArcGIS services.
// --------------------------------------------------------------------
var layer = new TileLayer({
url: "http://www.example.com/arcgis/rest/services/Folder/Custom_Base_Map/MapServer"
});
var customBasemap = new Basemap({
baseLayers: [layer],
title: "Custom Basemap",
id: "myBasemap"
});
myMap = new Map({
basemap: customBasemap
});
view = new MapView({
center: [-111.87, 40.57], // long, lat
container: "ui-map-view",
map: myMap,
zoom: 6
});
});
</script>
</head>
<body class="claro">
<div id="ui-map-view"></div>
</body>
</html>
Installing the ArcGIS JavaScript API SDK
The ArcGIS JavaScript API SDK can be copied in its entirety to your Web server directory. This SDK is equivalent to the version found on the ArcGIS for Developers JavaScript site.
Copy \arcgis_js_api\sdk and all its contents from the DVD to your web server. In this example the files are copied to: $apache_tomcat_home/webapps/arcgis_js_api/sdk
The start page is index.html.