TransWikia.com

Calculate cost of predefined path

Geographic Information Systems Asked by Steffan Clent Davies on August 4, 2020

I am trying to calculate the cost of walking a predefined path. The path can be a line or a number of points along that line. I have a DEM and derived it’s slope, which I will use as a friction map. I want to know the cost of getting from point A to point B using the line/points as a path, not the least cost path.

enter image description here

One Answer

Using GRASS GIS, you could convert the path to a raster, then extract the slope values from all slope pixels along the path raster, and sum them up. So:

# Assuming a line vector named "path" and cost raster named "slope"
v.to.rast input=path output=path type=line use=val value=1
r.mapcalc "path_cost = if (path=1, slope, null())"
# The sum of the pixels will be the total cost based on slope of all pixels "under" the path
r.univar path_cost # Check value of "sum"

Answered by Micha on August 4, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP