[GRASSLIST:4063] Re: direction to nearest...?
Glynn Clements
glynn.clements at virgin.net
Thu Jul 11 14:52:45 EDT 2002
Alex Thorn wrote:
> What I'd like to be able to do is to calculate the
> direction from a point to the nearest cell that has a
> given raster value (raster not important here, I just
> assume that it is the best way to implement this).
> 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?
> The commands dealing with
> calculating flow seem related, although they call for
> a continuous coverage (e.g. elevation), rather than
> discrete data about a particular feature being present
> or absent in a given cell.
>
> 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).
However, this won't give you the exact Euclidian distance, but an
approximation where "circles" are actually polygons (16-sided with the
-k flag, 8-sided without).
--
Glynn Clements <glynn.clements at virgin.net>
More information about the grass-user
mailing list