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" 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!

Related Questions

How to reduce the dbf size in shapefile in QGIS?

0  Asked on March 27, 2021 by blue_cat


Adjust pop up container in Leaflet

1  Asked on March 26, 2021 by mrsalamikuchen


Polygon layer became point layer when re-opening the project

0  Asked on March 26, 2021 by tomas-hughes-hallett


Converting XY coordinate points to Lat Lon

1  Asked on March 26, 2021 by konan-pruiksma


No option for R scripts in QGIS

0  Asked on March 26, 2021


Merging layers with same name in PyQGIS

3  Asked on March 26, 2021 by raosaeedali



0  Asked on March 26, 2021 by brbara-duarte


Ask a Question

Get help from others!

© 2022 All rights reserved. Sites we Love: PCI Database, MenuIva, UKBizDB, Menu Kuliner, Sharing RPP