[GRASS-user] r.cost source ID question...

If I have a r.cost surface calculated from a set of vector points used as starting points, and some cost surface, is there any way to easily retrieve the SOURCE vector ID that leads to the lowest cost to get to any cell in the raster? E.g. from a given point, where is the point that costs the least to get to?

--j

--

Jonathan A. Greenberg, PhD
Postdoctoral Scholar
Center for Spatial Technologies and Remote Sensing (CSTARS)
University of California, Davis
One Shields Avenue
The Barn, Room 250N
Davis, CA 95616
Cell: 415-794-5043
AIM: jgrn307, MSN: jgrn307@hotmail.com, Gchat: jgrn307

On Friday 29 February 2008, Jonathan Greenberg wrote:

If I have a r.cost surface calculated from a set of vector points used
as starting points, and some cost surface, is there any way to easily
retrieve the SOURCE vector ID that leads to the lowest cost to get to
any cell in the raster? E.g. from a given point, where is the point
that costs the least to get to?

--j

r.cost is generally used in conjunction with r.drain.

First a cost surface from:
- a starting point
- a set of starting points
- a line segment

is generated to:
- the edges of the region
- a stopping point
- a set of stopping points

Then r.drain is used to compute the least-cost-path between the starting
point/points/line and some arbitrary end point. With the idea that you
will "drain" some water down-slope the cost surface, back to your starting
point/points/line.

To find the least-cost-path between *any two points* I have generally found it
simplest to run r.cost + r.drain for every start/stop combination that I am
interested in. An example is posted here:

http://casoilresource.lawr.ucdavis.edu/drupal/node/244

note that the code describing this process on the referenced page is actually
an un-rolled foreach loop.

Hope that helps a little,

Dylan

--
Dylan Beaudette
Soil Resource Laboratory
http://casoilresource.lawr.ucdavis.edu/
University of California at Davis
530.754.7341

Jonathan Greenberg wrote:

If I have a r.cost surface calculated from a set of vector points
used as starting points, and some cost surface, is there any way to
easily retrieve the SOURCE vector ID that leads to the lowest cost
to get to any cell in the raster? E.g. from a given point, where
is the point that costs the least to get to?

It sounds a bit like an inverted topographic prominence problem.
  http://article.gmane.org/gmane.comp.gis.grass.user/19467/

As Dylan wrote, r.drain should help find the path to the nearest pit.
Other water flow modules may help too.

Hamish

      ____________________________________________________________________________________
Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

Jonathan Greenberg wrote:

If I have a r.cost surface calculated from a set of vector points
used as starting points, and some cost surface, is there any way to
easily retrieve the SOURCE vector ID that leads to the lowest cost
to get to any cell in the raster? E.g. from a given point, where
is the point that costs the least to get to?

It sounds a bit like an inverted topographic prominence problem.
  http://article.gmane.org/gmane.comp.gis.grass.user/19467/

As Dylan wrote, r.drain should help find the path to the nearest pit.
Other water flow modules may help too.

Hamish

      ____________________________________________________________________________________
Looking for last minute shopping deals?
Find them fast with Yahoo! Search. http://tools.search.yahoo.com/newsearch/category.php?category=shopping