Re: [GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-20 Thread Glynn Clements

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
> temp=r.grow.tmp.$$
> 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
> g.remove rast=$temp.dist,$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.

Done.

I've also fixed the spelling of "euclidean" in both r.grow and
r.grow.distance, in 6.4 and 7.0.

-- 
Glynn Clements <[EMAIL PROTECTED]>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


[GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-19 Thread Glynn Clements

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
temp=r.grow.tmp.$$
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
g.remove rast=$temp.dist,$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 <[EMAIL PROTECTED]>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-14 Thread Glynn Clements

Hamish wrote:

> is it ok to backport r.grow.distance to devbr6 for 6.4.0?

I can't think of any reason not to.

-- 
Glynn Clements <[EMAIL PROTECTED]>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-13 Thread Hamish
is it ok to backport r.grow.distance to devbr6 for 6.4.0?

AFAICT there are no issues.


Hamish



  

___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


Re: [GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-13 Thread Glynn Clements

Moritz Lennert wrote:

> >> r.grow.distance creates a distance map from each point, but
> >> there is no way of telling it anything about null cells or
> >> barriers. Even when setting a mask, r.grow.distance fills in
> >> the whole region, which seems like a bug to me.
> > 
> > 
> > perhaps if you invert the map?
> > 
> > 
> > ie put starting point in null space and it will grow until/around cells
> > with value?
> 
> You mean invert the mask, so that land masses are nulls and water 
> non-nulls ?
> 
> Doesn't work.
> 
> r.grow.distance just seems to ignore the mask. Glynn ?

As I wrote in this thread on grass-user:

> A mask just forces some input cells to be null. As a general
> principle, modules don't distinguish between cells which are null in
> the map itself and those which are null due to the mask.
> 
> 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.

IOW, the mask just makes some input cells "disappear".

-- 
Glynn Clements <[EMAIL PROTECTED]>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev


[GRASS-dev] Re: [GRASS-user] how to measure distances in a constrained space

2008-11-13 Thread Moritz Lennert

On 13/11/08 10:04, Hamish wrote:

r.grow.distance creates a distance map from each point, but
there is no way of telling it anything about null cells or
barriers. Even when setting a mask, r.grow.distance fills in
the whole region, which seems like a bug to me.



perhaps if you invert the map?


ie put starting point in null space and it will grow until/around cells
with value?


You mean invert the mask, so that land masses are nulls and water 
non-nulls ?


Doesn't work.

r.grow.distance just seems to ignore the mask. Glynn ?

Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev