Cost surfaces

From GRASS-Wiki
Revision as of 16:13, 28 December 2012 by Neteler (talk | contribs) (new)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Q: I have a friction map, a start polygon and an end polygon and would like to find the least cost path, meaning not a corridor but a thin line. The r.drain manual says: "If the input surface (a raster map layer) is a cumulative cost map generated by the r.walk or r.cost modules, the -d flag and a movement direction surface "indir" must be specified." I assume it's a kind of flow direction or aspect, but what is the physical meaning, and how can I calculate it?

A: The physical meaning is movement direction in degrees CCW from East, similar to e.g. flow direction output of r.watershed. The direction map is an optional output of r.cost and r.walk, and should be used with the indir option for r.drain.

The workflow would thus be:

  1. convert the first polygon to a raster map
  2. use all cells of the first polygon as start points for r.walk, include the friction map
  3. convert the second polygon to a raster map
  4. use the second polygon as a MASK and get the coordinates of the cell with the lowest cost
  5. use these coordinates as start coordinates for r.drain, together with the movement direction map and the cumulative cost map produced by r.drain