[GRASSLIST:4842] Re: best way to grow a distance layer?

Glynn Clements glynn.clements at virgin.net
Sat Oct 26 12:05:37 EDT 2002


Markus Neteler wrote:

> > I want to grow distance rings around some features in a large, high resolution
> > map.
> > 
> > Looks like r.buffer will do the job, but it only takes up to 60 buffer rings,
> > and this won't get me to the edge of the large map with a resolution of one
> > cell width.
> > 
> > Is there a single command in GRASS that will grow a distance layer out to the
> > edge of the map?
> 
> Not a single command, but a combination of two commands:
> You can use r.cost with input map containing 1 as values. Then, to
> translate the distance to meters, multiply with cell resolution.
> 
> Eg. something like distances to roads:
> 
> g.region rast=roads
> r.mapcalc area.one=1
> r.cost input=area.one output=distance start_rast=roads
> r.mapcalc dist_meters="distance * ewres()"

However, note that this won't compute the exact Euclidian distance,
but a polygonal approximation. Without the -k switch, r.cost will
produce octagonal "circles" (i.e. points of equal cost will form an
octagon); with -k, the circles will be 16-sided polygons.

If the features comprise a very small number of cells, you could use
repeated applications of r.circle, combined with r.mapcalc's min()
operator.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-user mailing list