Determining the Least Cost Path - A GIS Tutorial

The least-cost path is a method that can be used to determine the most optimum route between points based on your needs. This tutorial will help you do the trick.

Determining the Least Cost Path - A GIS Tutorial

The Least Cost Path (LCP), which falls under spatial analysis is a method to determine an optimal route for travel between points through unconstrained space.

In this article, I am going to be taking you through the process of doing a Least-Cost-Path analysis.

Example (Application)

The government of Zimbabwe is planning on expanding its road network to reach out to more remote locations that are in Zimbabwe. They need to find a route that is optimum and on which they can construct this road which will bear minimum costs on their budget. The road network is supposed to pass through essential service destinations that already exist in nearby towns (growth points, malls, etc.) based on their needs and requirements. As a GIS Analyst, your job is to help them by using all the spatial data and resources available.

By using LCP, you can be able to provide them with optimum routes that help ease the work and bare minimum costs.

Considerations

Before beginning any work, you need to look at the available resources and find a suitable criterion for use in your analysis.

Some considerations could be looking at:

  • Slope - where higher slopes are more costly than lower slopes
  • Land use coverage - areas that are built up or have been used by humans before can be less costly than intervened areas and also farmlands could be easy to work on than dense forests.

Tutorial

In this tutorial, we are going to be determining the least cost path for a village in Zimbabwe (Chipfiko) where we have an origin and a destination.

Tutorial Data

To follow along with each step, you can get access to this data for free.

Vector Data - https://arcg.is/1m0u9i (Points of Interest and Consideration)
Raster Data - https://arcg.is/0yXCWe0 (DEM & Land Use)

In the provided data for the tutorial, you should be able to find:

- Destination and origin points

- Land use data

- Digital elevation model

- Area of Interest (AOI)

- Including shapefiles of existing infrastructure within the area.

What you will learn

  • Building a model
  • Performing Spatial Analysis

Add Data to the Workspace

Make sure you have all the data required for this tutorial. Connect the folder to your data source and add the data onto the ArcMap workspace.

To come up with the Least Cost Path you need to go through several processes and this will involve the use of the ArcGIS model builder tool which creates a geoprocessing workflow that executes one function after the other.

Create a Toolbox

A toolbox is where our models and tools will reside in your GIS environment. In this case, you will create a separate toolbox to avoid mixing up the system's built-in tools and your customized geoprocessing workflow.

Open the ArcToolbox, right-click the ArcToolbox option and select Add Toolbox.

In the Add Toolbox popup, highlight a folder in which you would like your toolbox to reside and click the New Toolbox option.

Rename the toolbox (i.e., LeastCostTools)

Highlight your new toolbox and click OK.

Your new toolbox should be added to the list of toolboxes in the ArcToobox window.

Right-click on your new and recent toolbox creation, navigate to the new and open Model.

This is where we will be building our Least Cost Model.

Model Properties

Before you begin building, it is always recommended to configure your model properties to make sure you do not get things mixed up in the middle of your work.

In your model builder window, click Model and Model properties.

The model properties window will appear and you need to set a Name, Label, and description for your model. This will help others who are going to be using your model to better understand what it can be used for.

💡
The Name does not allow any whitespace. The label is the human readable name of your tool which will be displayed publicly and in the toolbox.

Once you have configured the General elements, switch to the Environments tab. Here you will configure the Workspace, Raster Analysis functions and Processing Extent. Select the checkboxes with these names from the environments tab.

Click on the Values button to configure these parameters. Configuring these parameters reduces repetitive tasks when building the model since you will be using the same values for all these three parameters.

Select the Chipfiko DEM as the Input raster and click Ok

💡
Notice the color change in the tool within model builder.

Execute the tool by right-clicking the Slope (yellow) process and selecting run.

Optionally and also recommended, rename the output element (green) of the tool.

In the image above, the output element has been renamed to DEM Slope for reference purposes in the next steps to follow.

💡
Notice the grey effect reflected by the tool. This effect is displayed on tools that have been already executed successfully within model builder.

Reclassify Data

In this step, you will classify the slope data to suit your needs. You can place the data into a different number of classes for example three classes to indicate high, low, and medium slope.

Navigate to Spatial Analyst Tools > Reclass > Reclassify.

Drag the Reclassify tool into the Model builder space as you did with the Slope tool.

Configure the process by double-clicking on the process name and placing it in the parameters.

In this case, the Input raster is from the DEM Slope raster which was the output for the Slope process and the class field is the Value field.

In the image above notice the New Values column for the data that has been created and also classified into simple values.

💡
To configure classification methods and number of classes click on the Classify button which is next to the Reclassification table. (i.e., Using Quantile method with 10 classes)

Click Apply and then OK.

Rename the Reclassification process output.

Weight Overlay

Drag the Weight Overlay tool into the Model Builder window.

Spatial analyst tools > Overlay > Weighted Overlay

Configure the Weighted Overlay process.

Set the evaluation scale to suit your needs. In this case, set as from 1 to 10 by 1.

Click on the Add Raster Row button. Select the Reclassed Slope as the input raster and leave the Value column as the default input field.

Click OK.

The field values have been matched with the scale values.

Click on the Add Raster Row again and this time add the land use layer. Select the type as the input field and select OK.

Assign scale values for the Land Usage types based on logic.

💡
A least scale value represents a lower cost

Also, set the influence of each parameter on the weights.

💡
The total percentage influence should amount to 100%.

See the sample configuration in the image below.

Click Apply and Ok.

Rename the output to Costs.

Cost Distance

The cost distance gives the distance to the nearest source for each cell in the raster-based on the least-accumulative cost over a cost surface.

Add the Cost Distance tool from the Spatial Analyst tool.

Spatial Analyst Tools > Distance > Cost Distance

Double click the cost distance to configure the parameters.

The input raster or feature source data will be your Destination, and the input cost raster will be the Cost layer from the weighted overlay output.

Optionally calculate the backlink (the directions) by finding a location and renaming the output.

Click Apply and then Ok.

Rename the outputs as Output Cost Distance and Output Backlink respectively.

Calculate Least Cost Path

Finally, we are now able to calculate the LCP between our origin and destination points taking into consideration all the weights that we have placed.

To do this you will use the Cost path tool.

Spatial Analyst > Distance > Coast Path

Drag the tool into the model builder.

Configure the parameters using:

Input Raster or Feature Destination data: Origin
Destination Field: OBJECTID
Input Cost Distance Raster: Output Cost Distance
Input Cost Backlink Raster: Output Backlink


Leave the Path type as EACH_CELL for now.

Click Apply and then OK.

Rename the final output to Least-Cost-Path. Now you are ready to run your model and provide the authorities with the least cost path for building the road.

Your final tool should look like the image above.

Run your tool by right-clicking on the Cost Path process and selecting Run, or click the Run icon to run the whole tool in model builder.

As each process along the way is executed, the color for the process will change to red one after the other. This might take some time depending on the processing power of your machine.

Once the tool has finished executing, a dialog will appear on your screen like above with the Completed Status on the loading bar.

To see our results, right-click on the final output (Least-Cost-Path) and select Add to Display.

Your least-cost path should now appear on your data within the ArcMap workspace.

See the image below which shows the path (in green) with the least costs involved for the road construction between the two points based on the specified costing metrics and parameters.

💡
The image displayed does not represent any recommended cartographic output and is simply for visual demonstration purposes for this tutorial.

That's. You have a proposed least-cost path and thanks to GIS.

Would you mind sparing a few seconds to answer this small survey about this tutorial?

Thanks very much for your consideration.

Get the PDF version of this tutorial for free. Download the PDF using this link - https://arcg.is/nK58K0