R.cost.full from the GRASS algorithm calculates an accumulated cost surface (i.e. a map of travel costs) for a unit cost layer/friction map. The output is a raster map where each grid cell has a value that represents the costs for getting to the closest source (e.g. the next town). Is there a possibility to extract which town is the closest source of each grid cell?

My intention is to get a second raster that contains the closest source (town) for all grid cells.

The manual states that by setting the parameter: outdir=name I can create a raster to contain movement directions. However this is not what I exactly need.

1 Answer 1


I am not sure about the options of r.cost exposed in QGIS processing, but if you run it in GRASS directly, r.cost has an output option nearest, which gives you a raster map where each cell has the value of the nearest point.

  • that's a good one. I don't know how I could oversee that. will give it a try. thanks!
    – joaoal
    Feb 7, 2017 at 20:04
  • works. one can eaven see the movement directions. I also saw that the option is available in the grass gui. I'm surprised that qgis does not implement all functions of the algorithm in its gui.
    – joaoal
    Mar 22, 2017 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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