Lesson 8: Network Analysis
Lesson 8 Introduction and Action List
Introduction
In Part I of this lesson, you will learn about the concept of cost distance analysis. In doing so, you will add point and road features to a layer, and compute the cost from each feature based on road type. You will work with ArcGIS Pro in Part I. In Part II of this lesson you will get an introduction to the QGIS interface by working with LA County bikeways data. In Part III you will submit a map for Peer Review. You can use a map from Part I or Part II.
At the successful completion of this lesson, students should be able to:
- Use Summary Statistics to create a look-up table,
- Analyze data with Cost Distance tools,
- Convert raster values from square meters to square miles, and
- Measure distances on a map.
Problem
The population in the County of Los Angeles continues to grow. The County has developed a “Roadmap to Achieve a Sustainable Waste Management Future”. The Roadmap lays out the general framework for the strategies and initiatives that the County can implement to “decrease reliance on landfills by maximizing the recovery of products, materials, and energy from waste that would otherwise be disposed at landfills, and provides direction to the Department of Public Works and other County departments to initiate the implementation of the Roadmap.” (Department of Public Works [1])
In order to maximize its facilities, the County wants to make sure the transfer stations they currently have are optimally placed to minimize transportation costs and not overburden particular landfills. This geographic question related to minimizing the cost of distance is referred to as cost distance analysis in a GIS.
At the conclusion of this lesson’s exercise, you should be able to determine areas of the county that may need a new waste management facility.
Important Key Words
Make sure you are familiar with these key terms that can be found throughout this lesson and course.
- Cost Distance Analysis
- Summary Statistics
Action list
Lesson 8 will take one week to complete. Specific directions for the assignments below can be found within this lesson.
- Read the Lesson 8 Concept Gallery content.
- Work through the Lesson 8 exercises.
Any Questions?
If you have any questions now or at any point during this lesson, please feel free to post them to help-from-instructors or arcgis-pro-assignment-questions channels in Slack.
Lesson 8 Concept Gallery / Background Reading
- Book (Chapter 10 – pages 471 – 475 re. Cost Surfaces)
- Bolstad, P. (2019). GIS Fundamentals: A first text on Geographic Information Systems, 6th edn. White Bear Lake, MN: Eider Press.
- Article(s)
- Retrospective GIS-Based Multi-Criteria Decision Analysis: A Case Study of California Waste Transfer Station Siting Decisions. Proc. ISSST, Cirucci, J.F., Miller, D.A., Blanford, J.I. http://dx.doi.org/10.6084/m9.figshare.1512514 v3 (2015) [2]
- Understanding Cost Distance Analysis (ArcGIS Pro Help) [3]
- Additional concepts
- Watch MGIS alum John Cirucci’s presentation: ISSST 2015 – Cirucci (Livestream Archive) [4]
Lesson 8 Activity, Part I: Cost of Distance Analysis
This exercise guides you through Part I of this week’s exercise.
- Post comments and requests for help in the Lesson 8 discussion space. Please include illustrative screen captures with requests for help.
- Some concepts and procedures introduced in this exercise will reappear in the quiz.
In Part I of this lesson, you will perform a cost distance analysis in ArcGIS Pro. In Part II, you will learn more about and practice with QGIS. In Part III, you will create and submit a map for peer review.
In this part you will find the distance to waste transfer facilities. First, you will determine the cost of travel to the transfer facilities based on distance along the road network. Next, you will determine the cost of travel to the transfer facilities based on distance and road type. In the latter method, road types, such as interstates, have less cost in terms of distance to the transfer facilities than local roads, for example.
Note: As you go through Part I and Part II, keep in mind that you will need to submit a map from one of those parts for peer review in Part III.
A. Download the Lesson Data
Download the Lesson 8 data (Lesson8.zip [5]) and unzip it in your course folder.
B. Organize the Data
- Open ArcGIS Pro and start a new blank project called GEOG483_Lesson8 in your Lesson8 folder.
- Add a new map and add the Lesson 8 data layers TransferStationsLACo, LandfillsLACo, AllRoadsLACo, and BoundaryLACo.
- Open the attribute table for the roads layer.
- Add a short integer field called Distance. [See Figure 8.1]
- Save the changes you made to the table.
- Calculate the Distance field so that all records have a value of 100.
Figure 8.1. Add a distance field.
C. Convert Vector Data to Raster Data
- We now want to create a raster layer from the AllRoadsLACo vector layer. Open the Conversion Tools > To Raster > Feature to Raster tool.
- Choose AllRoadsLACo as the Input features.
- Choose Distance for Field.
- Change the Output raster to Distance and make sure it is saved in your Lesson8 geodatabase. The path should look something like this (depending on the path or your data): C:\GEOG483\Lesson8\Lesson8.gdb\Distance.
- Change the Output cell size to 100. This will create a new raster layer in which each cell will represent a ground area of 10,000 square meters. [See Figure 8.2]
Figure 8.2. Convert to raster. - Click Run. The Distance raster layer will be added to the Contents pane. Close the Feature to Raster pane.
- Using the same process as with the AllRoadsLACo vector layer, create a raster layer from the TransferStationsLACo vector layer. Choose OpStatus for Field. Change the Output raster to TransfStat_raster and make sure it is saved in your Lesson8 geodatabase. Keep the default Output cell size of 221.225555600002.
- Turn off all of your other layers to see the raster layer you just created.
ArcGIS Pro Help: Find out more about Cost Distance Analysis in the ArcGIS Pro Help. Click the View Help (question mark) button in the top right of the ArcGIS Pro window. Click SEARCH at the top of the page and type “cost distance”. Read through the first few results.
D. Calculating Cost Distance
- In the Spatial Analyst > Distance toolbox open the Distance Accumulation tool.
- Choose the TransfStat_raster layer as the Input raster or feature source data.
- Choose Distance as the Input cost raster.
- Enter CostDist_1 for the Output distance accumulation raster. (should look something like: C:\GEOG483\Lesson8\Lesson8.gdb\CostDis_1) Leave the other items empty.
- Click Run. The task will complete, but there will be some warnings that say “Some sources are located on masked cells and will not be processed.” That is ok. The CostDis_1 layer will be added to the Contents pane. You just created a map that shows the distance from each waste transfer facility.
- Open the Symbology for the CostDis_1 layer. Change Primary Symbology to Classify, change the number of Classes to 9. [See Figure 8.3]
- Click the Analysis tab and click History to see the Geoprocessing History. You can see the various steps you have done so far. If you hover your mouse over the entries, you can see more detail.
Figure 8.3. Cost distance results layer.
E. Prepare the Weighted Cost Raster Layer
Now that we have the distance calculated, we will add variation in moving along the different networks. To do so, we will take different road types into account.
-
- Open the roads attribute table. We are going to create a summary table that shows us how many features are in each road type.
- Right-click the RTTYP field and click Summarize. The Summary Statistics pane will open.
- The Input Table should be ALLRoadsLACo.
- The default Output Table name is fine (AllRoadsLACo_Statistics).
- Choose RTTYP for Field. Change the Statistic Type to COUNT. [See Figure 8.4]
Figure 8.4. Finding the number of features of each road type. - Click OK.
- Open the AllRoadsLACo_Statistics table that is added to the Contents pane. Remember that we used a look-up table in Lesson 5. We are going to turn this summary table into a look-up table.
- Add a Text field called Description with a Length of 25.
- Add a Short integer field called Cost.
- Save the changes to the table.
- Take a look at the Census page for Route Type Codes and Definitions [6].
- Populate the Description and Cost fields according to the table below. You can click each cell to edit the values. In this scenario, 100 represents the highest cost of moving along a surface (e.g. slowest – such as on a local road) and 1 represents the easiest and most-efficient movement along a surface (e.g. fastest – such as on an interstate). [See Figure 8.5]
Figure 8.5. Populating the Description and Cost fields. -
- Join the AllRoadsLACo_Statistics table to the AllRoadsLACo using the RTTYP fields as the Input and Output Join Fields. Now, all of the records that had a value in the RTTYP field has a cost value associated with it. There are 54,817 features that don’t have a value in the RTTYP field. We will ignore those records since they are likely a type of “Other”.
- Export the joined layer (right-click on the layer and choose Data > Export Features) to a layer called AllRoadsLACo_cost.
- Change the symbology of the AllRoadsLACo_cost layer. This will help you see how the road type affects the layer created in the next section. If you change the symbology to Unique Values and use the Description field, you can make the Interstates, US Highways, Highways, and State Routes (in that order) most prominent. You may want to not display the Local and Other roads at all.
F. Create the Weighted Cost Raster Layer
- We now want to create a second raster layer. There is a bug that prevents us from creating new raster layers in the same geodatabase after using the distance accumulation tool. We will create a new geodatabase. With the View tab selected, click Catalog Pane.
- With Project selected, right-click Databases and choose New File Geodatabase.
- Browse to your Lesson 8 folder where your Lesson8.gdb is located. Create a new geodatabases – L8costdistance. [See Figure 8.6]
Figure 8.6 Adding a new geodatabase. - Open the Feature to Raster tool.
- Choose AllRoadsLACo_cost as the Input features. Choose Cost for Field.
- For Output raster, browse to the lesson geodatabase called L8costdistance and change the layer name to Cost. The path should look something like this (note that you are creating the layer in one of the new geodatabases you just created): C:\GEOG483\Lesson8\GEOG483_L8costdistance.gdb\Cost.
- Change the Output cell size to 100. Click Run.
- Open the Distance Accumulation tool (Spatial Analyst > Distance).
- Choose the TransfStat_raster layer as the Input raster or feature source data.
- Choose Cost as the Input cost raster.
- Name the Output distance accumulation raster CostDist2. The path should look something like this: C:\GEOG483\Lesson8\GEOG483_l8costdistance.gdb\CostDist2. Leave the other items empty.
- Click Run. You will get the same warning as you did the first time you ran this tool. That is OK. The CostDist2 layer will be added to the Contents pane. Now, we have created a surface that shows how travel will likely change due to different road types. You can symbolize the layer the way you symbolized the first cost distance layer you created. Compare the two cost distance raster layers you created.
Consider this: Can you see the difference between the two cost distance raster layers that were created? What caused the variations?
You have just completed Part I of this project, which involved doing a cost distance analysis. In Part II, you will experiment with some open source software.
Lesson 8 Activity, Part II: Getting Started with QGIS
This exercise guides you through Part II of this week’s exercise.
- Post comments and requests for help in the Lesson 8 discussion space. Please include illustrative screen captures with requests for help.
- Some concepts and procedures introduced in this exercise will reappear in the quiz.
QGIS is a professional Geographic Information System built on and distributed as Free and Open-Source Software (FOSS). QGIS is a software project supported by the Open Source Geospatial Foundation (OSGeo) [7] and is licensed under the GNU General Public License. QGIS is a cross-platform GIS application that will run on various operating systems including Windows, Mac OSX, or Linux and supports vector, raster and database formats.
You can download QGIS [8] from their website by selecting the green “Download Now” button and following the bulleted instructions below. We recommend installing the standalone long term release version of the software because it is a more proven and stable release (currently version 3.28).
- If you are running Windows, locate QGIS Standalone Installer Version 3.22 (under the heading Download for Windows, then Long term release (most stable)).
- Click QGIS Standalone Installer Version 3.28 to start the download process.
- If you are operating a Mac, scroll down to macOS, then locate Long Term Release, and click on QGIS macOS Installer Version 3.28.
A. Create a New Project and Add Data
- Start QGIS by selecting Programs > QGIS 3.X > QGIS Desktop 3.X from the Start menu on the Windows taskbar, or how you start your programs on a Mac.
- Look for the Browser Panel. If you do not see the Browser Panel open in your current project, select View > Panels > Browser Panel.
- In the Browser Panel navigate to your Lesson8 data directory (e.g., C:\PSUGIS\GEOG483\Lesson8), highlight and then grab the AllRoadsLACo.shp layer and drag the file into the Layers Panel (or an open Map Canvas). Click OK on the Select Transformation dialog box that pops up. Also add the BoundaryLACo.shp layer to the project. You can add multiple files at once by using the Shift or Ctrl keys.
- Change the name of the AllRoadsLACo.shp layer to “LA County Roads” by right clicking on the layer name in the Layers Panel > Rename. Also, rename the BoundaryLACo.shp to “LA County Boundary”.
- Download the LA County 2012 Bikeways KMZ file [9] to your Lesson8 data folder.
- From the Browser Panel, navigate to your Lesson8 data folder and drag the 2012 Bikeways KMZ file to the Layers Panel. Select All vector layers to add to the map. KMZ stands for Keyhole Markup language that is zipped. It is a compressed version of a KML (Keyhole Markup Language) file. KML files were originally developed for Google Earth but are now recognized as an international standard maintained by the Open Geospatial Consortium, Inc. (OGC)
- Modify the four bike layer names to be more descriptive:
- Rename the 2012 Bikeways Class 1 layer to “Bike Path”. The definition of a bike path is a separated, off-street, paved path that is a shared-use path for bicycles and pedestrians.
- Rename the 2012 Bikeways Class 2 to “Bike Lane”. A bike lane is on-street travel lane that is striped and has signage dedicated for bicycles.
- Rename 2012 Bikeways Class 3 to “Bike Route”. A bike route is an on-street travel lane shared by bicyclists and other vehicular traffic and marked with signage only.
- Rename 2012 Bikeways Cycle Track to “Cycle Track”. A cycle track is on-street one or two-way bikeway that is physically separated from other vehicular traffic.
- Experiment with reordering the layers by clicking on and dragging the layers in the Layers Panel with your mouse. When you are done, make sure the bike layers are positioned at the top of the Layers Panel. [See Figure 8.Q.1]
Figure 8.Q.1 QGIS Layers and Browser Panels.
- Select Project > Save As… and save your map project to your Lesson8 directory as QGIS_Lesson8. The file will be given the extension .qgs.
B. Set the Project Coordinate Reference System Properties
Changing the coordinate reference system of the project from the default doesn’t alter the stored coordinate system of any of the layers shown in the layers panel. It does, however, enable layers to transform on-the-fly.
Note: Read the QGIS Help [10] for more information regarding coordinate reference systems and map projections. You can navigate to a good section by typing Coordinate Reference Systems (CRS) in the Search text box and double-clicking Coordinate Reference Systems.
- From the Menu toolbar select Project > Properties…
- In the Project Properties dialog box, select the CRS menu
- In the Filter text box type “NAD 1983 Stateplane California V”. Highlight Projected Coordinate Systems > Lambert Conformal Conic > NAD_1983_StatePlane_California__FIPS_0405_Feet EPSG: 102645 and click Apply. [See Figure 8.Q.2]
Figure 8.Q.2 Project Properties CRS Form
- Select the General menu. Notice that the Map units are set to Meters.
- Click OK to close the Project Properties dialog box.
C. Change a Layer’s Display Style and Navigate Map
Use the Layer Properties Style Selector to change the symbols used to represent vector features in each layer. Select a combination of colors that is aesthetically pleasing to you.
- Within the Layers Panel, double-click on the Bike Path layer symbol to open the Layer Properties dialog. Select the Style menu if it is not open. To change the line layer display, choose a different color, symbol and/or size and click OK. Change the color, symbol and/or size of the other line layers listed.
- Now, double-click on the LA County Boundary layer to change the Transparency to 75% and the symbol fill to your desired color. [See Figure 8.Q.3]
To zoom to a feature in the map, click the Zoom In buttonon the tool bar. Click and drag a rectangle defining the area that you want to zoom in on. You can also move your mouse pointer over the map display and click once to zoom in on a point. To return to the full extent of your map display, click on the Full Extent button
on the tool bar.
You can also zoom in and zoom out using your mouse wheel by placing your cursor over the map and then rolling the mouse wheel forward or backward.Figure 8.Q.3 Change color, symbol, and size of layer features.
D. Install a Plugin to Add a Basemap
You are able to add Plugins to QGIS that extend the core functionality of the software. Plugins have been written by developers and other users and are made available in QGIS for all users.
- Click Plugins > Manage and Install Plugins. In Settings, check the boxes beside ‘Show also experimental plugins’ and ‘Show also deprecated plugins’.
- Select All tab and type the name of the plugin “openlayers” in the Search box and a resulting list will show.
- Highlight the OpenLayers Plugin and select the Install Experimental Plugin button. [See Figure 8.Q.4]
Figure 8.Q.4 The Plugin dialog
- Close the Plugins window.
- On the main menu, click Web > OpenLayers plugin > OpenStreetMap > OpenStreetMap.
Note: An alternative to the using the experimental OpenLayers plugin to add OpenStreetMap as a layer is to open the Browser panel and navigate to the XYZ Tiles > drag/drop the listed OpenStreetMap layer in the Layers panel.
- If necessary, adjust the draw order of the layers in the Layer Panel so that the OpenStreetMap layer is at the bottom of the list (the layers near the top of the list will draw over those toward the bottom). [See Figure 8.Q.5]
Figure 8.Q.5 OpenStreetMap added as a basemap.
E. Open an Attribute Table and Query the Data
- Right-click on the Bike Route layer in the Layers Panel and select the Open Attribute Table menu option.
- Choose the Select features using an expression icon
from the Attribute table toolbar.
- Expand Fields and Values and double-click on the Name field in the list box. It should appear in the text box at the left.
- Click on the equal sign operator.
- Click the All unique button so that all unique values become visible.
- Type “Pacific” in the Values text box. Double-click the PACIFIC COAST HWY.
- You should see the following expression: “Name” = ‘PACIFIC COAST HWY’ [See Figure 8.Q.6]
Figure 8.Q.6 Select by expression dialog box.
- Click the Select Features button to run the query. Two bike routes should be selected on the map.
- To view the selected features, click on View > Zoom to Selection.Now you know how to add layers, change symbology, change the coordinate system, add plug-ins, open attribute tables, and do attribute queries in QGIS. Feel free to experiment with the software more on your own.
To learn more about the software, visit the QGIS Training Manual documentation [10] available at qgis.org.
You have just completed Part II of this project, which involved getting familiar with QGIS!
Links
[1] http://dpw.lacounty.gov/epd/roadmap/
[2] https://www.researchgate.net/publication/308885055_Retrospective_GIS-Based_Multi-Criteria_Decision_Analysis_A_Case_Study_of_California_Waste_Transfer_Station_Siting_Decisions [3] http://pro.arcgis.com/en/pro-app/tool-reference/spatial-analyst/understanding-cost-distance-analysis.htm
[4] https://youtu.be/lg5j2oKMsBQ
[5] https://pennstateoffice365-my.sharepoint.com/:f:/g/personal/exf107_psu_edu/Esqvua5J7u9KkeDIQIaTiPQBLVi4IbmURmMTkab_xmj3mA?e=91aBJy
[6] https://www.census.gov/library/reference/code-lists/route-type-codes.html
[7] https://www.osgeo.org/
[8] https://www.qgis.org/en/site/
[9] https://pennstateoffice365-my.sharepoint.com/:f:/g/personal/mgz1_psu_edu/EmqrICIxXdxEhfcM1Xjm76gB0WOdwIDhp9O8C0PXjB0yFQ?e=ejx9DJ
[10] https://docs.qgis.org/3.10/en/docs/