Workshop: Spatial Analysis

Network analysis, using vector based data layers, can be useful to determine precise routing directions on a given road network. Here, we will determine best routes between destinations using raster datasets that determine cost based on cumulatively calculated cell values. We will use ESRI’s Spatial Analyst tools to perform least cost path analysis.

To begin, download the workshop geodatabase here:

Setting up your project

Through the process of this workshop, you will be creating many new data layers. It is always good practice to designate a path to the geodatabase that you will use to store the layers.

  1. Go to File, Map Document Properties…
  2. Change the default geodatabase by finding the path to the workshop geodatabase you just downloaded.
  3. Also click on the checkbox next to Store relative pathnames to data sources

Load your layers and set your environment for analysis

  1. From the workshop geodatabase, add the following layers to the map (you can drag and drop them from the ArcCatalog side panel on the right:
    1. la
    2. ny
    3. us_rail
    4. us_roads
    5. us_state_capitals
    6. us_states
  2. Go to Geoprocessing, Environment
    1. Set the Processing Extent to us_states
    2. Set Raster Analysis, Cell Size to 10000 (meters)
    3. Set Mask to us_states

What are my units?

Are we using feet? Inches? Miles? Or are we more non-American and using meters and kilometers? Your cell sizes and measurements in spatial analysis are dictated by what you chose as the coordinate system for your project. The layers in this workshop’s geodatabase have all been projected to USA Contiguous Albers Equal Area Conic USGS, which has a linear unit of Meters.

As the crow flies… Euclidean Distances and Allocations

How clustered are our state capitals? Which areas of our country are not even remotely close to a state capital? We can visually depict distances from any location in the country to their closest state capital by creating raster layers with cell data with distance measure.

  1. Open the search box and enter euclidean distance
  2. Click on the Euclidean Distance (Spatial Analyst) tool
    1. For input raster, choose us_state_capitals
    2. For output raster, choose your geodatabase, and name it us_state_capitals_euclidean
    3. Maximum distance: 500000
    4. For output cell size, enter 10000

 

What does the map tell us?

Examine the map and explain what you are able to observe. What do the colors represent? What does that tell us about the spatial distribution of our state capitals? Which city is not within 500km of a state capital?

Now, what if we were to redraw our state boundaries? And what if we were asked to do so in away that every single location in the country was allocated to its closest state capital?

  1. Open the search panel, and enter euclidean allocation
  2. Click on the Euclidean Allocation (Spatial Analyst) tool
    1. For input raster, us_state_capitals
    2. For source field, NAME
    3. Name the output allocation raster us_state_capitals_allocation
    4. For output cell size, enter 10000

What does the map tell us?

Examine the map and explain what you are able to observe. What do the colors represent? What state would Los Angeles be in?

Finding the “cheapest” route between two cities

First, convert the layers that we will use for our cost analysis into rasters. For this workshop, we will convert our roads and railways.

  1. In the search box, enter Feature to Raster and click on the tool
    1. Input features: us_roads
    2. Field: NewClass
    3. Output raster: us_roads_raster
    4. Output cell size: 10000
  2. Repeat the process but perform it with us_rail
    1. Input features: us_rail
    2. Field: Class
    3. Output raster: us_rail_raster
    4. Output cell size: 10000

In order to calculate the accumulated cost distance from LA, we need to create two rasters: one for distance, and one for direction. This will allow us to later calculate the least cost path from LA to any destination in the US.

  1. Search for cost distance and click on the tool
    1. Input source: la
    2. Input cost raster: us_roads_raster
    3. Output distance raster: CostDistance_LA_roads
    4. Output backlink raster: CostDirection_LA_roads
  2. Also create the cost distance rasters for the railways:
    1. Input source: la
    2. Input cost raster: us_rail_raster
    3. Output distance raster: CostDistance_LA_rail
    4. Output backlink raster: CostDirection_LA_rail

Finally, we are ready to calculate the least cost path between Los Angeles and New York.

  1. Search for cost path and click on the tool
    1. Input raster destination: ny
    2. Destination field: OBJECTID
    3. Input cost distance raster: CostDistance_LA_roads
    4. Input cost backlink raster: CostDirection_LA_roads
    5. Output raster: CostPath_LA_NY_roads
  2. Repeat the steps for the railways
    1. Input raster destination: ny
    2. Destination field: OBJECTID
    3. Input cost distance raster: CostDistance_LA_rail
    4. Input cost backlink raster: CostDirection_LA_rail
    5. Output raster: CostPath_LA_NY_rail

What does the map tell us?

Which path has a higher cost? How many state capitals does each path travel through?

Where can I find out more?

Find out more about cost distance analysis here.