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:

Obtaining Software

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.

283

Using Geospatial Technologies

The concepts you’ll be working with in this lab are used in a variety of real-world applications, including:

(Source: © Stocktrek Images, Inc./Terry Moore/Alamy)

Lab Data

Copy the folder Chapter8—it contains:

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:

284

8.1 Google Earth’s Shortest-Path Functions

  1. Start Google Earth (GE) and Search for: Virginia Beach, VA.
  2. 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:
    1. A: 2400 Atlantic Avenue, Virginia Beach, VA 23451 (this is the Museum you’re driving from)
    2. B: 201 E. Brambleton Avenue, Norfolk, VA 23510 (this is the Norfolk Scope you’re driving to)
    3. (Source: Google)
  3. Click the Get Directions button for Google Earth to compute the shortest route between the two points.
  4. The shortest path will be highlighted in purple.
  5. Make sure the Roads layer is turned on in the Layers box.

    Question 8.13

    X1O5837etviboB5tKkuoZrvkaRXSkIIqvmGam5mQvYPLp6ghHRC8yg/MhF6FcFL3Wmf3mBWGgstCUqVfdrEqnUFBmWC7cvrTU7OJ0U7ioM4Fq5WW0nJaSJLLX688r1btFzXWgpTWiiwq5u2uRWaQy/hjuK81PdQmxEr9lVESvxnS9Ruhw/rLJS2KUEV4RiCa+4Ev00GIKqOmomjayg6icw==
  6. 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

  1. 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.
  2. Type Virginia Beach, VA and click the Search button.
  3. 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.
  4. Select By Car for your method of travel (the car icon) and click on Get Directions.
  5. 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)
  6. 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).
  7. 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
  8. 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
  9. 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=
  10. 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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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)
  6. 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)
  7. Make sure the following fields are selected:
    1. Location / Address – should be ADDRESS
    2. City / County – should be CITY
    3. State/ Province / Postcode – should be STATE
    4. Zip / Postcode / Country – should be ZIP
  8. All other fields can stay at their defaults.
  9. Lastly, click on the green Make Map button.
  10. You’ll see a Google Map generated of Virginia Beach that contains symbols indicating the libraries’ locations. This means the geocoding process is complete.
  11. 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.
  12. Open your Web browser and navigate to: http://www.gpsvisualizer.com/geocoding.html.
  13. On the Website, click the link for Geocode multiple addresses. A new Web interface will appear.
  14. Return to Excel and re-copy all of the data, including the headers for each column.
  15. Back on the GPS Visualizer Website, paste all of the Excel data in the Input box.

    289

    (Source: GPSvisualizer, NAVTEQ, Yahoo)
  16. For the various settings, use the following:
    1. For Type of data, choose tabular (columns & header row).
    2. For Source, choose Yahoo!.
    3. For Field separator in output, choose tab.
  17. When the settings are correct, press the Start geocoding button.
  18. The “Results as Text” box will fill in with the results of the geocoding process.
    (Source: GPSvisualizer, NAVTEQ, Yahoo)
  19. 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.
  20. After choosing that option, click on the Draw a map button.
  21. 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).

    290

    (Source: GPSvisualizer)
  22. Click on the link and if prompted choose to Open With Google Earth. Click OK in the dialog box.
  23. Also, do NOT close the browser window with the geocoded data. We’ll return to it later in the lab.
  24. 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.
  25. 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.
  26. 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.
  27. 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)
  28. Select the Great Neck Area Library, right-click on it, and select the directions from here option.
  29. In the Search box, you’ll see the Search option switch to say “Great Neck Area Library” with its latitude and longitude.
  30. Next, locate the Princess Anne Area Library, right-click on it, and select the directions to here option.
  31. 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=
  32. 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.

  1. Return to Google Earth, right-click on the GPS data .kmz file, and select Copy.
  2. 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.

292

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

  1. 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.
  2. 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.
  3. Open ArcToolbox by selecting its icon from the Standard toolbar (it’s the small red box icon):
    (Source: Esri)
    (Source: Esri)
  4. 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.
  5. 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.

    293

    (Source: Esri)
  6. 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).
  7. Select LONG for the X Field.
  8. Select LAT for the Y Field.
  9. Leave the Z Field blank.
  10. Type GISlibraries for the Layer Name.
  11. From the Spatial Reference choices, select Geographic Coordinate Systems, then select World, then select WGS84.
  12. Click OK when all settings are ready.
  13. 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.
  14. 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.

    294

    (Source: Esri)
  15. Use the same coordinate system as this layer’s source data.
  16. 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)
  17. In the Saving Data dialog, navigate to the Chapter8 folder and call the new file you’ll be creating Pointlibraries instead of Export_Output.
  18. In the Save as type: option, use the pull-down menu to select Shapefile.
  19. 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.
  20. 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.
  21. Turn off the old GISlibraries event layer. You’ll be working with the Pointlibraries shapefile in the next part.
  22. 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.
  23. In the Data Frame Properties dialog, select the Coordinate System tab.
    (Source: Esri)
  24. 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.

296

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).

  1. 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)
  2. Next, use Select By Location to find all library points (the Pointlibraries) within 2 miles of the selected road segments of Atlantic Avenue.

    297

    (Source: Esri)

    Question 8.22

    jkpkJUJ43wXZy3+qDCG+fAcSTfG7d8vA5++LH0U0uKPtj5fLofbJ315u9Y3ScFp4otKQsDmEKxTtetpXk9GO2jPmrPgaLINzjJe/muwoJ5VXG/LXXW31Nw==
  3. 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.
  4. 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+
  5. 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.
  6. 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).