The purpose of this activity was for me to learn how to utilize the ArcGIS JavaScript API to embed GIS services into any website. I used these services to create interactive maps featuring pop-up information, and routing services.
Methods:
Part 1: Creating a basic Web GIS mapping app
In order to create and style the first map page, I imported Esri's Dojo Dijit "claro" stylesheet, and the Esri stylesheet for web maps immediately below my basic meta tags (Figure 1). The Dijit themes establish how the map is going to look in the browser.
| Figure 1: Basic HTML code with stylesheet references. |
| Figure 2: Web map extent CSS. |
Next I used a <script> tag to reference the ArcGIS JavaScript API (Figure 3). This allows my HTML page to implement the API.
| Figure 3: Referencing the ArcGIS JavaScript API |
| Figure 4: Creating the web map extent and referencing claro. |
| Figure 5: The JavaScript code to create a map. |
| Figure 6: The newly created map! |
In the next portion of the lab, I created a map of San Francisco, CA with pop-up windows showing tree species (Figure 7).
| Figure 7: Trees of San Francisco, California. |
| Figure 8: The JavaScript code for the pop-up window. |
I then adjusted the HTML, so that the extent would be centered on downtown Eau Claire, Wisconsin. I used a feature service of the schools, and created pop-up windows to show the name, elevation, and address of every school (Figure 9).
| Figure 9: The pop-up window |
In the final portion of the lab, I created a routing application centered around downtown Eau Claire, but with the capability to route anywhere in the U.S.A.. In order to do so, I first created an HTML page with a viewport tag, so it will be responsive on iOS devices. Next, I referenced both the "esri" and the claro stylesheets, as well as the ArcGIS API for JavaScript.
After saving my HTML, I created used JavaScript to create a new map, and calibrated it to center in on downtown Eau Claire. Next, I referenced the network service from Esri's servers. I then added arguments to solve the task, symbolize the map, add stops to the map, show the route, and send an error message to the end-user if they demand an erroneous route. After finishing the JavaScript, I referenced it in the HTML, and added text to describe the app to the end-user.
Results:
The first map runs completely in the browser, without any additional plug-ins.
![]() |
| Figure 10: The first map, as viewed on an iPhone. Notice how the zoom tool is barely visible, this makes it impossible to click with a finger. |
The second map features pop-up windows, a scalebar for reference, and "viewport" tags to adjust the scaling of the map to be operable on iPhones (Figure 11).
![]() |
| Figure 11: The second map, as viewed on an iPhone. The viewport tag resized the zoom tool to fit the screen. |
The third map performs simple routing while embedded in an HTML page, with "viewport" tags to adjust scaling for iOS devices (Figure 12).
![]() |
| Figure 12: The third map, as viewed on an iPhone. |
The viewport tag for HTML is truly a very useful tool, as it helps make the app more responsive on iOS devices (Figure 13).
| Figure 13: The viewport tag. |
Map One
Map Two
Map Three
Sources:
EC_Schools feature class was obtained from MapCruzin.com at
http://www.mapcruzin.com/geographic-names-shapefiles/#School
EC_Schools_Address was assembled by GEOG 455 class, fall 2013.
Widget_infowindow files were provided by Esri at
https://developers.arcgis.com/javascript/jssamples.html


