[GRASS-dev] Re: [GRASS-user] how to measure distances in a
glynn at gclements.plus.com
Wed Nov 19 18:20:40 EST 2008
Glynn Clements wrote:
> In any case, the specific purpose of r.grow.distance is:
> r.grow.distance generates a raster map representing the distance to
> the nearest non-null cell in the input map.
It now has an additional function: to generate a raster map containing
the value of the nearest cell.
>From this, it is possible to mimic the behaviour of r.grow, but
substantially faster, with e.g.:
# equivalent to: r.grow input=$inmap output=$outmap radius=$radius metric=$metric
r.grow.distance in=$inmap distance=$temp.dist value=$temp.near metric=$metric
r.mapcalc "$outmap = if($temp.dist < $radius,$temp.near,null())"
r.colors $outmap rast=$temp.near
Whereas the worst-case time taken by r.grow is proportional to the
square of the buffer radius, the above is proportional only to the
area of the map, regardless of the buffer radius.
I'll replace r.grow in 7.0 with a script along these lines.
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-dev