Least-cost path around Volcan Muhabura; or how to avoid volcanos with GRASS GIS in 3D

Least Cost Path or How to Avoid Volcanoes with GrassGIS

Recently (ok, I have been working on-and-off on this for longer than I’d like to admit) we needed to solve a least cost path problem. I poked around and looked at a few solutions.

_images/costpath2.png

One was in Jared Erikson’s Python GDAL/OGR Cookbook which was fun to play with. This is a fun solution as it’s pretty low level, so you can see all the parts and pieces. Check it out: it may be a useful think if you really need a python only solution.

Another solution is to use GRASS GIS. The trick is to use calculate the cost surface between two points, and then proverbially let the marble roll down that cost surface.

First the problem — what the most efficient way (ignoring roads, trails and other affordances) to get from one side of Volcan Muhabura (on the border of Rwanda and Uganda) to the other? In a few weeks I hope to hike that mountain, assuming my knee and lungs survive the journey, and so perhaps I am thinking of alternatives… .

Shaded elevation model of Muhabura with the beginning and ending points labeled.
Shaded elevation model of Muhabura with the beginning and ending points labeled.

Now that we have the elevation model, we need to calculate the cost distance raster. First we run

r.slope.aspect

to create some intermediate elevation products, then finish the process by using

r.cost
Depiction of cost surface in blue.
Depiction of cost surface in blue.

Now we have our cost surface. Time for some marble rolling with

r.drain

Ok. Maybe it’s a rain drop. Anyway:

Depiction of cost surface with least cost path overlaid with a nice long path around the edge of the mountain.
Depiction of cost surface with least cost path overlaid with a nice long path around the edge of the mountain.

Finally, I find it satisfying to visualize this back on the original hillshade.  Maybe I will propose this as our hike instead. What do you think? Ok, the views might not be quite the same as they will be at the top… .

Least-cost path around Volcan Muhabura; or how to avoid volcanos with GRASS GIS in 3D

2 thoughts on “Least Cost Path or How to Avoid Volcanoes with GrassGIS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s