I am completely a beginner in GRASS but I would like to use it to have the cumulative cost of moving between two polygons. More exactly, I would like to get the smallest cost from any point situated at the edge of one polygon (polygon A) to any point situated at the edge of another polygon (polygon B).
Until now, I used the function CostDistance
and CostPath
of ArcGIS like this:
CostDistance("start_polygon", "costs.tif", "", "outCostLink.tif")
CostPath("end_polygon", "outCostDist.tif", "outCostLink.tif", "EACH_ZONE","FID")
I would like to do the same thing with GRASS. I think that the function r.cost
allows to do this. But the problem is that I don't understand how to specify in parameters the two polygons in GRASS ?
I have :
- a cost raster where each cell has a cost value.
- a shapefile for the first polygon
- a shapefile for the second polygon
Have you got an example of how to use r.cost
with two polygons ?
Thanks very much for your help.