Tracking Creatures of Bavarian Folklore Using a Least-Cost Path Model

Table of Contents

  1. Tracking Creatures of Bavarian Folklore Using a Least-Cost Path Model
  2. Setting up Your Workspace
  3. Preparing the Data
  4. Skill Drill: Geocoding an Address and Creating a CSV Table to Import As XY Data
  5. Skill Drill: Defining the Study Area
  6. Skill Drill: Acquire Elevation Data from the USGS National Map Viewer
  7. Skill Drill: Acquire Land Cover Data from the USGS National Map Viewer
  8. Skill Drill: Acquire Hydrography Data from the USGS National Map Viewer
  9. Changing Global Environment Settings for Raster Processing
  10. Creating Cost Surface Models Using a Relative Cost Scale
  11. Creating a Remap Table to Reclassify Elevation
  12. Skill Drill: Creating a Remap Table to Reclassify Slope
  13. Skill Drill: Creating a Remap Table to Reclassify Tree Canopy Density
  14. Converting the Hydrography Features to Cost Surface Models
  15. Creating a Total Cost Surface Model
  16. Creating a Cost-Distance Surface Model
  17. Creating a Migration Corridor
  18. Determining the Least-Cost Path
  19. Skill Drill: Creating a Map of the Results

Converting the Hydrography Features to Cost Surface Models

Your next cost raster will be based on hydrography. The wolpertinger prefers to avoid crossing water bodies, such as lakes and rivers. To create a cost surface model representing water features, you must first convert the hydrography layers from vector to raster format. Create a new field in the attribute table of the rivers layer. Name this field Cost. This field will record the relative cost of traveling over rivers and streams. You will use the field calculator to populate all the records in the field with a value of 10, so the field type should be a short integer. Use the Field Calculator to set the values in the Cost field to 10. If you recall from previous courses, you can access Field Calculator by right-clicking on the field name, Cost.

An image of the Add Field window

You may notice that not all of the records were updated by the field calculator. If you set up your Environments settings correctly in an earlier step, you limited the processing extent to match the digital elevation model. The Field Calculator honors this global setting, and only changes river segment attributes that fall within this extent. This setting can save quite a bit of computer processing time when you work with more massive datasets, like the NHD layers. In the next few steps, you will see that other tools also honor the global Environments settings.

An image of the rivers with a cost of 1 selected
In this image, the Select by Attributes tool was used to select the rivers that were assigned a cost of 10. As you can see, only the rivers within the DEM boundaries were changed by the Field Calculator. This image is for demonstration only. You do not need to select these records. Click to view a larger image.

In ArcMap, locate and open the Feature to Raster tool in the Conversion Tools, To Raster toolbox.

An image of the Feature to Raster tool in Coversion Toolbox
In ArcMap, locate and open the Feature to Raster tool in the Conversion Tools, To Raster toolbox.

For the Input Features, load the NHD layer representing rivers and streams. Under the Field, choose the Cost field. Save the output to your working folder. You want the output raster to match the same cell size as the digital elevation model. Under Output cell size, browse to your clipped DEM file. Click OK. The result is a raster layer representing the cost of traveling over rivers. However, there is a problem. While the rivers segments have been converted to pixels with a value of 10, areas that were not rivers were assigned a pixel value of NoData. Because you will be combining the cost surfaces in a later step, the NoData values will cause trouble. Any mathematical operations, such as addition or multiplication, that encounter a pixel with a NoData value, will result in a NoData value as the output. To fix this, you must convert all of the NoData values to 1.

An image of the Feature to Raster Tool
An image showing river segments as pixels
What was once vector data is now converted into a raster with river segments at one-pixel wide.

Sometimes ArcMap is buggy when it comes to the Feature to Raster tool. If you encounter problems, you may want to try Polyline to Raster or Polygon to Raster, depending on your situation.

Open the Reclassify tool and load the river raster file as your Input Raster. You will not need a reclass table for this simple conversion. Instead, you can enter the values manually in the Reclassification fields. Under New values, enter 10 where the Old values are 10. Under New values, enter a 1 where the Old values are NoData. Save the file to your working folder. Leave all other settings as default and click OK.

An image of the Reclassify tool

The result will be a new raster layer where rivers have a pixel value of 10, and all other areas have a value of 1.

An image of the river cost added to ArcMap
In this image, the areas representing the rivers are one-pixel wide. You may need to zoom in to see them. Click to view a larger image.

Skill Drill: Converting the Hydrography Features to Cost Surface Models

You will repeat the same steps for the NHD waterbodies and NHD areas layers. Start by adding a cost field to each and populating the field with a value of 10. Again, you will use the Feature to Raster tool. Don’t forget to set the Output cell size to match the DEM. Use the Reclassify tool to remove NoData values and convert them to values of 1.

An image of the NHD Areas cost layer.
In this image, the NHD rivers, areas, and water bodies have been converted from vector to raster data. Each should have pixel values that are either 1 or 10. If you have not done so already, take the time to clean up your Table of Contents. Remove any unnecessary layers to avoid clutter.

Skill Drill: Using the Con Function to Combine Hydrography Layers

When you are done, you should have a total of three cost surface models, one for the NHD waterbodies, the NHD areas, and the rivers. However, you want one cost surface model representing the relative cost related to hydrography. To do this, you will have to use the Con function in Raster Calculator to combine the three layers that water features have a value of 10 and all other areas have a value of 1.

The Con function evaluates each pixel in a raster for a specific condition. If the condition is true, it will receive one value. If the condition is false, it will receive another value. In this instance, the Con function will check to see if the pixels in each dataset have a value of 10. If so, the pixels in the output raster will also receive a value of 10. Otherwise, the Con function assigns a value of 1. The Con function uses the following structure:
Con(in_conditional_raster, true_raster, {false_raster})
In this instance, you need to create a compound conditional statement separated by an OR operator to account for multiple raster datasets. Open the Raster Calculator. If you will recall from previous courses, you can find this tool in the Map Algebra toolbox under Spatial Analyst Tools. Enter the following function in the Raster Calculator:

Con(("water_area_cost.img" == 10) | ( "water_body_cost.img" == 10) | ("rivers_cost.img" == 10),10,1)

Name the output “Hydrography_cost.img.” The result will be a single raster layer that combines the NHD waterbodies, the NHD areas, and the rivers. Once you have completed this section, you should have a single cost surface model representing the relative cost or likelihood, on a scale of 1 through 10, that this species will traverse each pixel based on the presence of water features. In the image below, the four cost surface models you will need are displayed along with the Orick and den locations layers. Take a moment to clean up your Table of Contents. Remove unnecessary layers to avoid clutter and confusion and save your map document. In the next few steps, you will only need your cost surface models, the den locations, and the town of Orick.

An image of the hydrography cost layer