Least Cost Path Analysis

Part A — Cost Surfaces and the Cheapest Route

CE 414 Engineering Applications of GIS
Dr. Dan Ames
Civil & Construction Engineering
Brigham Young University

CE 414 · Week 12 — Least Cost Path Analysis, Part ALast Updated: 2026-10-09© 2026 Daniel P. Ames · CC BY 4.0

Today's Goals

  • By the end of class you should be able to:
    • Say what a cost surface is, and why it is not a map of distance
    • Build one by reclassifying and combining rasters with map algebra
    • Explain what the accumulated cost and back link rasters each store
    • Trace a least-cost path from a destination back to its source
    • Name the ArcGIS Pro tools that do each step, and their current replacements
CE 414 · Week 12 — Least Cost Path Analysis, Part A

What is the shortest path?

  • What is the "cost" Google Maps is minimizing here? Distance? Travel time? Traffic?
  • This route runs from the NSA Utah Data Center in Bluffdale south toward Spanish Fork Canyon — the two endpoints of Lab 11
  • More on the NSA Utah Data Center, code named "Bumblehive"

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Why Least-Cost Path?

  • From Esri's documentation (arcgis.com): the least-cost path is "one cell wide", runs from the destination back to the source, and is "guaranteed to be the cheapest route" in the cost units of the input cost raster
  • Three things to hold onto:
    • the answer is a raster path, one cell wide, until you convert it
    • it is computed backward, destination → source
    • "cheapest" only means anything relative to the cost raster you built

center

CE 414 · Week 12 — Least Cost Path Analysis, Part A

General Workflow

  1. Combine your raster data sets into a "virtual terrain", where high values are undesirable paths and low values are desirable paths
  2. Identify a start point (source) and an end point (destination) for the path of interest
  3. Run Distance Accumulation to create the accumulated cost raster and the back direction raster
  4. Run Optimal Path As Line with those two rasters and the destination: the path, already a line
CE 414 · Week 12 — Least Cost Path Analysis, Part A

The whole model, end to end

center

Every green oval is a data set, every yellow box a tool. The routing happens in the last boxes at the bottom right.

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Current tool names in ArcGIS Pro

  • Cost Distance, Cost Back Link and Cost Path still run, but are deprecated
  • Distance Accumulation: the accumulated cost and the back direction raster, in one run
  • Optimal Path As Line: replaces Cost Path, and draws the line itself
  • Lab 11 uses the current tools; Thursday compares the two sets on its data
CE 414 · Week 12 — Least Cost Path Analysis, Part A

Step 1: building the cost surface

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Combine Rasters into a "Virtual Terrain"

  • Every data set has to be converted to raster first
  • Reclassify so that high values represent the least desirable cells to cross
  • Combine them with map algebra in the Raster Calculator — add, multiply, or weight and add
  • This "virtual terrain" is properly called a cost surface
CE 414 · Week 12 — Least Cost Path Analysis, Part A

Why "Virtual Terrain"?

center

  • The simplest cost raster you could use is a DEM
  • The result then follows the lowest and flattest route from start to end

gisgeography.com/least-cost-path-analysis/

CE 414 · Week 12 — Least Cost Path Analysis, Part A

The values do not have to be elevation

  • Any number that represents the cost of crossing a cell will do
  • Here the dark cells cost 4 and the light cells cost 1
  • The straight line from A to B is short but expensive; the stepped red path is longer and cheaper
  • That is the whole idea: shortest ≠ cheapest

center

dyerlab.github.io/applied_population_genetics

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Step 2: accumulated cost, back link, and the path

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Cost Distance and Back Link rasters

  • Cost distance (accumulated cost): for every cell, the cheapest total cost of reaching it from the source. Light = cheap to reach, dark = expensive
  • Back link (back direction): for every cell, which neighbor to step to next on the way home to the source — coded 0–8
  • Cost Path starts at the destination and follows the back link raster cell by cell until it reaches the source
  • That is why the path is computed backward

center

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Some real-world examples

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Next: Lab 11, power line routing

  • Route a high-voltage line between two existing substations: Spanish Fork Canyon to Bluffdale
  • You build the cost surface yourself from slope, roads, cities, existing power lines and rivers, each scored 1 to 10, with lakes as barriers
  • Then the two-tool routing you just saw: Distance Accumulation and Optimal Path As Line
  • The whole thing lives in one ModelBuilder model so you can change a weight and re-run it
CE 414 · Week 12 — Least Cost Path Analysis, Part A

Final Thoughts

Quiz: Cheapest or Shortest? Five questions on what a cost surface stores, and why the cheapest line is not the shortest. Scan the code, or open the link under it.

  • Not graded, nothing recorded: a quick check that today's material made sense
  • Watch the reclassification sign in Lab 11: high means undesirable

Before next class

center

byu-hydroinformatics.github.io/ce414-gis-applications/quizzes/least-cost-path/

CE 414 · Week 12 — Least Cost Path Analysis, Part A

Concepts lecture for Week 11. This deck sets up Lab 11, the power line routing model, so keep pointing forward to it: everything here is a piece of that model.

stamp:begin

stamp:end

Frame the hour. The whole lecture is one idea repeated at three scales: a cell has a cost, a path is the sum of cell costs, and the cheapest path is not usually the shortest one.

Open with the question, not the answer. Google Maps is already doing least-cost path analysis; it just hides the cost function. Ask what it is minimizing, and get students to notice that the fastest route and the shortest route are different lines. Then say that in Lab 11 they write the cost function themselves. The two photos are the endpoints of that lab: the data center in Bluffdale and the wind farm at the mouth of Spanish Fork Canyon.

The quotation is condensed from the arcgis.com wording on the original slide. Emphasize the last bullet: the algorithm is exact, but it is exact about the cost surface you gave it. Garbage weights, confident wrong answer. The map on the right is a student example layout from a previous semester; its text block is still placeholder ("Name / Date / Projection"), which is a good chance to point out that the rubric wants those filled in.

These are the steps as Lab 11 runs them, with ArcGIS Pro's current tools. The source slide named Cost Distance, Cost Path and a final Raster to Polyline; Optimal Path As Line makes the polyline itself. The legacy names come back on the deprecation slide. The next slide shows the whole Lab 11 model, so students can see how much of it is step 1.

TODO(graphic): a clean five-step schematic of this workflow — input rasters, reclassify, Raster Calculator, cost surface, source/destination, accumulated cost + back link, path. Not generated here; needs a real figure.

Do not read this diagram. The point is scale: about thirty tools, and only the last two are the least-cost path itself. Everything else prepares the cost surface. Say plainly that this is what Lab 11 asks them to build. The image is Lab 11's Figure C, the model exported from ModelBuilder in the October 9, 2026 build of the lab.

Lab 11 is built on Distance Accumulation and Optimal Path As Line. On its cost surface the legacy chain gives 58.49 km against 56.09 km, within 788 m everywhere (Thursday's deck). Say this out loud rather than leaving students to discover the deprecation warning in the tool's help. The concepts are identical: accumulated cost plus a back-direction raster, then walk the back-direction raster home. Only the tool names and a few parameter names moved.

The capture is Cost Distance opened in ArcGIS Pro 3.7.1's Geoprocessing pane (October 9, 2026), showing the tool's own deprecation notice; the Thursday deck, least-cost-path-b, shows Distance Accumulation and Optimal Path As Line, and the two tool sets' routes on Lab 11's data (56.09 km and 58.49 km).

Two steps in the figure: cost surface generation on top, least-cost path determination below. The AHP box is one way to pick criteria weights; students are not required to use it in Lab 11, but it answers the question "where do the weights come from?" Stress that all the inputs must share a projected coordinate system, cell size, and extent before the Raster Calculator will give a sensible answer.

Start with the case where the metaphor is literal: the cost surface is real terrain, and the path is what water or a road would do. This is why the cost surface gets called a virtual terrain even when the values are not elevation.

Walk one path by hand. Count the cells along the straight line and multiply by their costs, then count the cells along the red path. It is worth doing the arithmetic on the board once; after that the algorithm is obvious. Also point out that diagonal moves cost more than orthogonal ones, by a factor of about the square root of 2, which is why the red path is stepped.

The two rasters are the whole algorithm. The accumulated cost raster says how much; the back link raster says which way. Ask students what would happen if you only had the accumulated cost raster: you could still walk downhill through it, but the back link raster stores that answer once instead of recomputing it. Note the concentric shape of the accumulated cost raster around the source, and how it bulges where crossing is cheap.

TODO(instructor): this figure is a scanned page from an ArcMap-era tutorial. It shows the ArcMap Table Of Contents, the CostDistance and Backlink layers, and numbered steps 10-11. Needs a fresh ArcGIS Pro capture of the same two rasters in the Contents pane. Not fabricated; kept as-is so the content is not lost.

Three published applications, all using the same two rasters. Use them to make the point that the engineering judgment lives entirely in the cost surface. Ask what a cell should cost near a school, a wetland, or a scenic corridor, and let the disagreement stand.

TODO(instructor): the source slide gives only bare DOIs/links for these three papers. Add author, year, and title so students can cite them, and confirm each link still resolves.

Preview the lab; the map is Lab 11's example baseline layout. The reason it is a model and not a sequence of clicks is that the weights are arguable, and a model lets them re-run the analysis after changing one. Encourage students to run at least one alternative weighting and look at how far the path moves.

Four to five minutes, in pairs, then a show of hands on the item that splits the room every time: what a single cell of the cost surface actually stores. Half the class picks "the total cost of the cheapest route to that cell", because that is the raster they just watched get built - so name the difference out loud. A cell of the cost surface is a price for crossing that one cell; the accumulated cost raster is the running total of the cheapest way to reach it. Everything else in the hour hangs off that distinction. If the room has no signal, put the URL on the board; the items read aloud just as well.

Conversion notes (2026-09-03): source "CE 414 Week 11 - Least Cost Path Analysis.pptx", 9 slides, converted to 16. No source slides were dropped; there were no hidden slides and no speaker notes in the original, so every presenter note here is new. Added: a Today's Goals slide, two lead section dividers, a dedicated full-size slide for the ModelBuilder overview, a "Current tool names in ArcGIS Pro" slide, a Lab 11 preview, and a Before Next Class slide. The legacy Cost Distance / Cost Back Link / Cost Path workflow was deliberately NOT rewritten: Lab 11's steps, screenshots and rubric use the same legacy tools, and the two have to change together. The deprecation is stated on its own slide instead. Stale imagery: images/lcp-cost-distance-backlink-arcmap.png is a scanned ArcMap-era tutorial page and needs a Pro capture; images/lcp-full-model-overview.png is an illegible zoomed-out ModelBuilder canvas and needs a re-export from ModelBuilder. Both are flagged inline. The arcgis.com quotation on the "Why Least-Cost Path?" slide was condensed to short attributed fragments rather than reproduced in full; the original slide did not cite which arcgis.com page it came from. The student example map (images/lcp-example-map-power-lines.jpg) still carries its placeholder "Name / Date / Projection" text block; kept, and used in the speaker notes as a rubric reminder. Nothing outside slides/week-11/ was created or modified. Realigned October 9, 2026 with the rebuilt Lab 11: General Workflow names the current tools; the model overview is Lab 11's exported Figure C (lcp-lab11-model.svg), replacing the illegible lcp-full-model-overview.png; the Lab 11 preview uses the lab's example map.