8.2 Geospatial Lab Application: Geocoding and Shortest Path Analysis: ArcGIS Version
This chapter’s lab will introduce you to the concepts of calculating a shortest path between stops along a network as well as generating directions for the path using Google Earth and Google Maps. You’ll also be performing geocoding using a Web service, examining the geocoding results, then performing some basic spatial analysis of the results in relation to a TIGER file using Google Earth and ArcGIS.
The previous version of this lab (Geospatial Lab Application 8.1: Geocoding and Shortest Path Analysis: QGIS Version) uses the free Quantum GIS (QGIS). However, this lab provides the same activities for use with ArcGIS 10.1 or 10.2.
Objectives
The goals for you to take away from this lab are:
- to familiarize yourself with the shortest path and directions functions of Google Earth.
- to use Google Maps to alter the shortest path to account for route changes.
- to utilize an online geocoding service to geocode a series of addresses, and then examine the results.
- to use ArcGIS to plot the results of a geocoding operation.
- to examine some basic spatial analysis of locations and their relation to a road network (TIGER file) in ArcGIS.
Obtaining Software
- The current version of Google Earth (7.1) is available for free download at http://earth.google.com.
- The current version of ArcGIS is not freely available for use. However, instructors affiliated with schools that have a campus-wide software license may request a 1-year student version of the software online at http://www.esri.com/industries/apps/education/offers/promo/index.cfm.
Important note: Software and online resources sometimes change fast. This lab was designed with the most recently available version of the software at the time of writing. However, if the software or Websites have significantly changed between then and now, an updated version of this lab (using the newest versions) is available online at: http://www.whfreeman.com/shellito2e.
Using Geospatial Technologies
The concepts you’ll be working with in this lab are used in a variety of real-world applications, including:
- emergency services, which utilize geocoding to determine the location of 911 callers, so that the nearest available aid can be quickly dispatched to the right place.
- commercial promotion and postal services, where traveling sales representatives and delivery drivers make use of routing information to take the shortest and most obstacle-free paths between destinations
(Source: © Stocktrek Images, Inc./Terry Moore/Alamy)
Lab Data
Copy the folder Chapter8—it contains:
- a Microsoft Excel spreadsheet featuring a series of addresses to be geocoded.
- a second Microsoft Excel spreadsheet containing latitude and longitude coordinates for each address.
- a .kmz file containing library locations in a format readable by Google Earth.
- a TIGER 2000 line file in shapefile format.
Localizing This Lab
The datasets in this lab focus on the locations of public libraries and the road network in Virginia Beach, Virginia. However, this lab can be modified to examine your local area by doing the following:
- Use your local county library’s Website (or the phone book) as a source of names and addresses of local libraries, and use Microsoft Excel to create a file like the one in the Chapter8 folder (where each column has a different attribute of data). If there are not enough local libraries around, use the addresses of other local venues, like coffee shops, pizza shops, or drugstores.
- A TIGER file (in shapefile format) of the roads of your county can be downloaded for free from Esri at http://arcdata.esri.com/data/tiger2000/tiger_download.cfm. Unzip the file and the shapefile will be ready to go (this was the source of the Virginia Beach TIGER file used in this lab). Coordinates are in NAD83 decimal degrees.
8.1 Google Earth’s Shortest-Path Functions
- Start Google Earth (GE) and Search for: Virginia Beach, VA.
- Let’s start with a typical summertime scenario: You’re on vacation in Virginia Beach, visiting the Old Coast Guard Museum (which fronts onto the oceanfront boardwalk). You have tickets to see a show at Norfolk Scope Arena, located in nearby downtown Norfolk. You want to take the shortest route to get from your beachfront location to the arena. Like you did in Geospatial Lab Application 1.1, select the Get Directions link. Use the following addresses for directions:
- A: 2400 Atlantic Avenue, Virginia Beach, VA 23451 (this is the Museum you’re driving from)
- B: 201 E. Brambleton Avenue, Norfolk, VA 23510 (this is the Norfolk Scope you’re driving to)
(Source: Google)
- Click the Get Directions button for Google Earth to compute the shortest route between the two points.
- The shortest path will be highlighted in purple.
- Make sure the Roads layer is turned on in the Layers box.
Question
8.13
X1O5837etviboB5tKkuoZrvkaRXSkIIqvmGam5mQvYPLp6ghHRC8yg/MhF6FcFL3Wmf3mBWGgstCUqVfdrEqnUFBmWC7cvrTU7OJ0U7ioM4Fq5WW0nJaSJLLX688r1btFzXWgpTWiiwq5u2uRWaQy/hjuK81PdQmxEr9lVESvxnS9Ruhw/rLJS2KUEV4RiCa+4Ev00GIKqOmomjayg6icw==
- The search box will give information about the length of the route.
Question
8.14
u4G2+ALZeTWTik4KQUvGeUZjkGr3mctj1dUWjX62JhyN+hwnVQSv7Vki9SoQ634trmCYIRw0gubjROp1INvnuxlJtCoaXVZk88YuuYo0MeD41N4nrLYMiKcchIA=
8.2 Google Maps’ Shortest-Path Functions
- Keeping in mind the shortest path that Google Earth calculated, open your Web browser and navigate to the Google Maps Website at http://maps.google.com.
- Type Virginia Beach, VA and click the Search button.
- When the map of Virginia Beach appears, select Get directions and use the Old Coast Guard Museum address for option A and the Norfolk Scope address for option B.
- Select By Car for your method of travel (the car icon) and click on Get Directions.
- The shortest route between the two points will appear, highlighted in purple. It should be the same route that GE calculated for you. It may give an alternate route to take as well.
(Source: Google)
- Zoom in closer to the original point A. Scroll the mouse over the purple shortest path line and you’ll see a white circle appear along the path. This lets you change the calculated route to account for any variety of factors (such as travel preference, known congestion or construction areas, rerouting to avoid likely trouble spots or known delays, and so on).
- Start by placing the mouse over the turn onto I-264 and drag the circle up to state route 58 (also known as Laskin Road or Virginia Beach Boulevard—the other major east-west road just above and parallel to I-264). The route will change by first having you drive north on Atlantic Avenue, turning west on 58, then merging back onto I-264 again a little later on the route. Even though it’s a small change, you’ll see that the driving distance and estimated time have changed. Answer Question 8.3. When you’re done, return the circle back to its original starting point and the route will go back to how it originally was.
Question
8.15
A870lmyizUln0Mu/TGYcDyzf4r6V4lj2zqhIGiI5fOtlcJ2dPEJKPKQbwFQKOCjrjlALJygpCj8jzaV/G7TYftpgf8xS7helTMplhzkegIeZUWGwKUz1WndedqOM0T/mfgS3ohBho5y3of+JzTcZoIoIgh0RJpbJ
- Scroll across the map until you see where the route crossed I-64 (about two-thirds of the way between the two points). I-64 is the major highway into the Hampton Roads area. Let’s throw another change into the scenario—say, for instance, that there’s heavy construction on I-264 west of the I-64 intersection. At the intersection, move the circle off the route and north onto I-64 far enough that the remainder of the route to Norfolk Scope diverts your shortest path headed north onto I-64 and not so that it returns you to I-264 west (you may have to move other circles as well if Google Maps diverts your path back onto I-264).
Question
8.16
Cw5st5KssoLvSGYaB+W0MbY+5zcBZtNw/mtN881OvPDav0jZa/FJeqO7QOhBZcU7/IdYoE+LAdFRTTWnDr91mUgGy7ZQsVLCXzja7Pbq3EZpCQUp2LzM52+UNtQ=
Question
8.17
u+VzLJ3u9dUwt/Ec+afeKLFIRbXokBIyUF2HXjv3D/b0SiFT5ZqF4/8VYzkVr3MWSnYJuYbmDOG3cvweF6GqIe0KSaYJXPVzJyvbMrTqJdQHCPt1FY4u4t3UN5dswKzsAQlsnbrNqk3iwkvlFR73TQ6rV0Twb+9SxVCuY/r0F3YF3jiCupEROvi2UoheCfG0evDxylRA1Xeins7Qin91OBSF2tCZl2ewBZMl8QyGtfrKOJPqPg+r3XX5amBnEATWTrN1K4qve0xUREowM0pb6y3Xd5MbwShMESORz6+basOW2acl6jWJnXD+xndw0uDe
- Reset the route back to its original state. Now, change the route so you would have to travel south on I-64 instead of north (still avoiding I-264).
Question
8.18
Cw5st5KssoLvSGYaB+W0MbY+5zcBZtNw/mtN881OvPDav0jZa/FJeqO7QOhBZcU7/IdYoE+LAdFRTTWnDr91mUgGy7ZQsVLCXzja7Pbq3EZpCQUp2LzM52+UNtQ=
Question
8.19
z3cEYWS1KR1i2TJDUnHFbEcA6UsauhSmJuCZ122B2j68Zw7NaqAKtsB0/8ghyBJqU68nJ3KdHHL+fBbJOO/tssuckF+2Y+FIznsJYkJBB9+BF2DfgtTJxWswh6XMPOhiHgXA+PYLf0kRLD/e7/B35Ks2xF4MYLp3s84SXzFC0gMAuN2so2MfnVAk5gOXOjYrX4CKzoE2hMs4bIgzAoO+ZciwKKjW0801zDuQRCakqlH+Z/gvHc5l69ugllc=
- All of these options can be used to model alternative routes or potential barriers or user-defined choices during shortest-path calculations. Each of these routes is a “best route,” just based on the parameters (such as simulating barriers) given to the system.
8.3 Geocoding and Google Earth
Before any type of shortest path could be calculated, the system first had to match the addresses of the starting and ending points to their proper location. The next section of this lab will introduce a method of doing this address matching (geocoding) to create a new point layer for use.
- Open a new tab or window with your Web browser and go to the URL http://batchgeo.com.
Important note: BatchGeo is a free online tool that will let you match multiple (or single) addresses to their road-network locations and create a point layer marking each of those address locations. In this portion of the lab, you’ll still be working with the Virginia Beach area, focusing on the locations of the city’s public libraries.
- Open the VBLibraries file in the Chapter8 folder (it’s in Microsoft Excel format). This lists the names and addresses of ten different public libraries in Virginia Beach.
- Use the mouse to select all rows and columns in the Excel file that contain data in them (including the column headers like “Name,” “Address,” and so on). Copy this data.
- On the BatchGeo Website, click the mouse in the “Copy and then paste your location data below” box to select all of the data listed in it and delete it. Then paste the data from the Excel file in place of it. The box will now show all of the data from the Excel file but separated by large spaces.
- Click on the Validate & Set Options button. This will ensure that the data is properly in the format that batchgeo.com needs it to be in. If an error message comes up, delete the information in the box, then re-copy and paste the Excel data.
(Source: BatchGeo)
- Next, BatchGeo needs the names of the fields identified for it to begin the geocoding process (in other words, it wants to know which column contains the Address data, which column contains the Zip Code data, and so on).
(Source: BatchGeo)
- Make sure the following fields are selected:
- Location / Address – should be ADDRESS
- City / County – should be CITY
- State/ Province / Postcode – should be STATE
- Zip / Postcode / Country – should be ZIP
- All other fields can stay at their defaults.
- Lastly, click on the green Make Map button.
- You’ll see a Google Map generated of Virginia Beach that contains symbols indicating the libraries’ locations. This means the geocoding process is complete.
- Pan and Zoom around the map to get a feel for where the libraries have been geocoded to. If you want, you can save this map for your own use. However, at the time of this writing, you can’t access any coordinate data for the points or download a Google Earth compatible file. In order to get both of these things, you’ll use a different Web resource.
- Open your Web browser and navigate to: http://www.gpsvisualizer.com/geocoding.html.
- On the Website, click the link for Geocode multiple addresses. A new Web interface will appear.
- Return to Excel and re-copy all of the data, including the headers for each column.
- Back on the GPS Visualizer Website, paste all of the Excel data in the Input box.
(Source: GPSvisualizer, NAVTEQ, Yahoo)
- For the various settings, use the following:
- For Type of data, choose tabular (columns & header row).
- For Source, choose Yahoo!.
- For Field separator in output, choose tab.
- When the settings are correct, press the Start geocoding button.
- The “Results as Text” box will fill in with the results of the geocoding process.
(Source: GPSvisualizer, NAVTEQ, Yahoo)
- In the format pull-down menu under the “Draw a map” button, select KML (G. Earth). This will enable the GPS Visualizer Website to create a file of the geocoded addresses that is compatible with Google Earth.
- After choosing that option, click on the Draw a map button.
- A new Web page will open and a blue and white “KMZ” icon will be shown with a link next to it (the link will be a string of numbers ending in the letters .kmz).
(Source: GPSvisualizer)
- Click on the link and if prompted choose to Open With Google Earth. Click OK in the dialog box.
- Also, do NOT close the browser window with the geocoded data. We’ll return to it later in the lab.
- In the Places box, there should be a new heading for Temporary Places, and under that should be a new checkbox for a .kmz file called GPS data. Turning this option on and off will toggle the display of the points representing your geocoded libraries. Basically, the GPS Visualizer Website converted the geocoded locations into a file that could be read by Google Earth. Note that a copy of this GPS data .kmz file is included with the Chapter8 folder, just in case you’re unable to access the Web resources that were used to generate it.
- Once the geocoded results are added to Google Earth, in the Google Earth view you’ll see each of the libraries represented by a point.
- To make your layer easier to see, right-click on the GPS data file and select Properties. Under the Style, Color tab you can alter the color and size of both the icons and their labels.
- Rolling the mouse over the top of a point will display its name. Clicking on a point will open a box with its name and address. Right-clicking on a point will allow you to access options for Directions to be calculated to that point or from that point.
(Source: Google, SIO, NOAA, U.S. Navy, NGA, GEBCO)
- Select the Great Neck Area Library, right-click on it, and select the directions from here option.
- In the Search box, you’ll see the Search option switch to say “Great Neck Area Library” with its latitude and longitude.
- Next, locate the Princess Anne Area Library, right-click on it, and select the directions to here option.
- In the Search box, the information about the new Princess Anne destination will be added. A new shortest path from the Great Neck Area Library to the Princess Anne Area Library will be calculated and displayed in purple.
Question
8.20
B4HXGD/PtlR0mxNyeZ3v0poCKh7pgCMrr/yjL0GYL4kh1xH0OSDL16NnJ6gAYwR4xB/Bpl21d0EU4IBS4SYAHQFt2/jAyCADkrGlfyzFez9qMLCsMSriamQWmwFCGm3JnxOsZAuceJBykhsnOcT5F6BpZ+43VKx2gM0F5MaPOCQzZuEJ7/L+iuSmeLU=
- Locate both the South Rosemont Youth Library and the Oceanfront Area Library.
Question
8.21
Pg4WDezC+qHmBtfOZD4hnzWIyr2f4QpYa/rGDX5uMWx/PS8IdsczMti3kgCcNzt0kkXwLfqxbgkHhA0DqtS8HCnjBOVnKcXsdqVd2x4ULUlfDFnQTHe6qILFQIuq0kjHMC3HdR6l3+l3hZlxNMFMsfWZTZsnVF3iUQA6OqY3IKyp7YZ8ivpoKfy1X9Q=
8.4 Preparing Geocoded Results for GIS Analysis
The next step of the lab will investigate how to use the GIS road files (like a TIGER file) and these geocoded results in GIS.
Important note: ArcGIS 10.1 and 10.2 have full geocoding capabilities, allowing you to start with a table of addresses and create a point layer from them (without having to use a Website to perform the geocoding). However, you can use the results from the GPS Visualizer Website with ArcGIS by converting the address points into latitude/longitude coordinates and mapping those as points in ArcGIS. The GPS Visualizer Website may report back the latitude and longitude coordinates for all geocoded points. If so, it’s easy enough to copy the full contents of the “Results as text” box into an Excel spreadsheet. You will then have the addresses and their coordinates together in a file. Also, the latitude and longitude coordinates for each point are stored in the .kmz file you loaded into Google Earth.
- Return to Google Earth, right-click on the GPS data .kmz file, and select Copy.
- Open a text editor utility like Notepad (in the Accessories folder in Windows), and Paste the .kmz file there.
You’ll see the code that makes up the file, including the latitude and longitude coordinates for each geocoded point. You could make two new columns in the original Excel table—one for latitude and one for longitude—and copy and paste the coordinate information for each one into its proper place in the table. It’s a longer way of doing things, but in the end you’ll have coordinates for each geocoded address available.
For the purposes of this lab, a separate Excel file called VBCoords is available within the Chapter8 folder that has all of this done for you.
Important note: The latitude and longitude computed by gpsvisualizer.com are decimal degree values.
8.5 Plotting Geocoded Results in ArcGIS
- Start ArcMap. From the Chapter8 folder, add the tgr51810lka.shp shapefile to the map (see Geospatial Lab Application 5.2 for the basics of starting ArcMap and adding data to it). This shapefile is a TIGER 2000 file of the Virginia Beach road network.
- Open the TIGER file’s attribute table. You’ll see it contains 19,026 records, each representing a link of the city’s road network. You’ll also see the standard TIGER file information of address ranges, census feature class codes, and so on assigned to each link. You can close the attribute table for now.
- Open ArcToolbox by selecting its icon from the Standard toolbar (it’s the small red box icon):
(Source: Esri)
(Source: Esri)
- ArcToolbox is a dockable window that contains a multitude of useful tools for ArcGIS. From the Data Management tools, select Layers and Table Views, then select Make XY Event Layer.
- An Event Layer will be a temporary layer created from a set of coordinates. In this case, you’ll be plotting points based on the latitude and longitude coordinates of the geocoded addresses.
(Source: Esri)
- Choose the VBCoords.xls file (the Sheet1$ part of it) as the XY Table (that ArcMap will use as the source of the latitude/longitude values).
- Select LONG for the X Field.
- Select LAT for the Y Field.
- Leave the Z Field blank.
- Type GISlibraries for the Layer Name.
- From the Spatial Reference choices, select Geographic Coordinate Systems, then select World, then select WGS84.
- Click OK when all settings are ready.
- A new point layer will be created called GISlibraries, with each point representing the location of a library in Virginia Beach. Open this new layer’s attribute table and you’ll see that all of the data from the file with the addresses has been imported into ArcGIS attribute table format.
- In order to use this layer for querying, it will first have to be converted into a format like a shapefile. To do this, first right-click on the GISlibraries file and select Data, then Export Data. A new Export Data dialog will appear.
(Source: Esri)
- Use the same coordinate system as this layer’s source data.
- In the Output feature class option, press the browse button. By default, ArcGIS will want to name the new shapefile Export_Output.shp, but you will change that in the next step.
(Source: Esri)
- In the Saving Data dialog, navigate to the Chapter8 folder and call the new file you’ll be creating Pointlibraries instead of Export_Output.
- In the Save as type: option, use the pull-down menu to select Shapefile.
- Click Save when everything’s ready. This will return you to the Export Data dialog, except that your Output feature class should now be Pointlibraries.shp. If everything’s okay, click OK to continue. ArcGIS will export your event layer into a shapefile called Pointlibraries.
- Click Yes when you’re prompted and asked if you want to add the exported data as a new layer. Pointlibraries will appear in the Table of Contents.
- Turn off the old GISlibraries event layer. You’ll be working with the Pointlibraries shapefile in the next part.
- Lastly, you’ll be doing the analysis in the next step using a projected coordinate system, in particular UTM (and using UTM Zone 18, since that’s where Virginia Beach is located). To set this up for all of the layers you’re using, right click on the Data Frame (it has the word Layers in the TOC) and select Properties.
- In the Data Frame Properties dialog, select the Coordinate System tab.
(Source: Esri)
- In the filter options type: UTM Zone 18. This will limit the choices to only those of UTM Zone 18. In the search results, select Projected Coordinate Systems, then UTM, then NAD 1983, and finally NAD 1983 UTM Zone 18N. When NAD 1983 UTM Zone 18N shows up as the Current Coordinate System, click Apply, then OK.
8.6 Some Basic Analysis of Geocoded Results in ArcMap
In this part, you will start performing some basic spatial analysis to examine the relationship between the library locations and the road network (see Geospatial Lab Application 6.2 for details on how to build queries based on attributes and queries based on location using ArcMap).
- First, use the Select By Attributes tool to build a query selecting all road segments that have their name (FENAME) equal to ‘Atlantic’ (Atlantic Avenue is a main north-south road that runs parallel to the boardwalk along the Virginia Beach oceanfront). Press the Get Unique Values button to access the names of all the roads. You’ll see the road segments that make up Atlantic Avenue appear in the default cyan color of selected ArcMap features.
(Source: Esri)
- Next, use Select By Location to find all library points (the Pointlibraries) within 2 miles of the selected road segments of Atlantic Avenue.
(Source: Esri)
Question
8.22
jkpkJUJ43wXZy3+qDCG+fAcSTfG7d8vA5++LH0U0uKPtj5fLofbJ315u9Y3ScFp4otKQsDmEKxTtetpXk9GO2jPmrPgaLINzjJe/muwoJ5VXG/LXXW31Nw==
- Clear the selected features from the roads and libraries and then select all road segments with their name equal to ‘Virginia Beach.’ This will select the segments that comprise Virginia Beach Boulevard, a major east-west corridor that runs through the center of Virginia Beach from the oceanfront on the east straight through into Norfolk on the west.
- Next, use Select By Location to find all library points within 2 miles of the selected road segments of Virginia Beach Boulevard.
Question
8.23
W8P7UIjecslb903Pr3UlDzP9TesOiim7XPLS3sOvS94jKgrUTrPrV3QFMGD5NQOTiz62R5rKXBVtBBKH4SfcKqb1aGn1ygR1TtyxgZWNaNHgS5Diu+2Gc4gQjMDZSpP+
- Clear all selected features and build a final query to select all road segments with their name equal to ‘Independence.’ This will select all the segments that comprise Independence Boulevard, a key north-south road in the middle of Virginia Beach.
- Next, use Select By Location to find all library points within 2 miles of the selected road segments of Independence Boulevard.
Question
8.24
BSK610vjWaCGfu8889PP97Rceritc4CfWewZWvz0WPoqEmCq/Bmp8UaTOGq3cSlfRazwWk5yxuYT5udpnN7R9aPnuumeCBxsC7ObaP4RsmB7MVi/3ngo/yy1jbRvDSB8
Closing Time
This lab demonstrated several types of features associated with geospatial network data, including calculating a shortest path, geocoding, and using geocoded results in conjunction with a road-network file in GIS. Chapter 9 will switch gears and introduce some new concepts, dealing with remote sensing of Earth (and the roads built on top of it).
- Exit Google Earth by selecting Exit from the File pull-down menu. Exit ArcGIS as well.
- There’s no need to save any data in this lab.