4

I'm trying to write a script to calculate the least cost path between two cells on a raster. I'm reasonably familiar with the approaches used by tools such as GRASS GIS's r.cost and ArcGIS's CostDistance tools. However, there is one constraint I can't figure out how to include:

The path represents the route of a pipeline carrying water. An increase in elevation incurs a cost (due to the pumping required). However, for a given elevation this is a one-off cost. i.e. the pumping cost is only related to the height of the source and the single highest elevation the path travels through. If the path passes through a cell at 5m elevation, it doesn't cost anything to travel through any other cell at the elevation.

How could I go about incorporating this constraint in my analysis? I'm open to any solution, but preferably one that could be scripted (and extra points for free/open source!).

  • Is this a zonal maximum problem where the zone is defined by the pipeline and the maximum of the elevation model. So extract the elevations by the line and attribute it with the highest one. Do the same for minimum and subtract the two and this is the pumping height. – If you do not know- just GIS Oct 4 '14 at 2:27
  • I don't follow what you mean. I understand how to find the highest elevation intersecting the line, and the elevation of the source and target points, but not how to include this in a least-cost path algorithm. – Snorfalorpagus Oct 5 '14 at 21:46
2

I've found a solution to this, but it requires some brute force.

  1. Find the most cost efficient route, ignoring the cost associated with elevation gain.
  2. Find the maximum elevation of the inital route.
  3. For each elevation X between the source elevation and the maximum elevation:

    • Assign an infinite cost to cells above elevation X
    • Find the most cost efficient route via the new array
    • Calculate the total cost of this route
  4. Find the route with the minimum total cost.

The graph below shows an example of this. In this instance, the route that reaches no higher than 240 metres is the best balance between distance (and other factors) and elevation gain.

max elevation allowed vs total cost

This solution isn't ideal as it requires running the slow path finding algorithm multiple times. However, it does produce the results I needed.

I'll leave this question "unanswered" for a litte while longer, as I'm keen to see some other solutions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.