[GRASSLIST:4066] Re: direction to nearest...?

Alex Thorn amthorn1979 at yahoo.com
Thu Jul 11 19:06:31 EDT 2002


--- Glynn Clements <glynn.clements at virgin.net> wrote:
> Alex Thorn wrote:
> > I've been looking over the available GRASS
> commands,
> > but haven't been able to find something that will
> do
> > quite what I want.
> 
> Is r.distance not suitable?

Note that I was looking for direction, rather than
distance.  I don't actually know the all of
capabilities of r.distance (it doesn't seem to be
listed in the man pages that came with GRASS 4.3, and
haven't looked it up online), but "r.distance help"
seems to indicate that it is just for calculating
distances.

> > It seems that I ought to be able to get something
> > along the lines of the flow/drainage models to
> work if
> > I can generate a coverage in which each cell is
> > defined by its distance from a cell with the
> > appropriate raster value (I seem to remember
> reading
> > about something like this in one of the
> tutorials).
> 
> That should be achievable with r.cost, with a
> constant cost map and a
> start_rast map where the only non-null cells are
> those with the chosen
> value (e.g. generated by r.reclass).

Again, r.cost give a raster representation of the path
to take, whereas I'm looking for a direction.  This
sounds like a nifty way of using r.cost that I had not
known about, though.

What I've ended up doing (for now, anyway):
1) Used r.buffer to generate a bunch of buffers around
the raster values of interest.
2) Used mapcalc to assign appropriate values to all
cells not included in the outermost buffer.
3) Assume that the resulting coverage is a surface,
and use r.slope.aspect to obtain the direction to the
nearest raster cell of interest in degrees.

A bit convoluted, but it does what I want, more or
less.  I'd be interested if anyone has any simpler or
otherwise preferable approaches.

Thanks again,
Alex

__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com



More information about the grass-user mailing list