[GRASS-user] Distance layer

Nomad Rain nomadrain at gmail.com
Sat Oct 28 12:11:04 EDT 2006


Thank you, Dylan and Jachym

I tried r.distance (the problem mentioned doesn't prevent)

Yes  it  gives  me  distances between raster pixels. However I need to
calculate in cycle all the distances from the only point to every NULL
pixel in region on new layer.

And r.distance does not work with null values, do it?

Help please, because my intuition keeps silence

---
Victor Yeliseyev

> On Friday 27 October 2006 11:12, Jachym Cepicky wrote:
>> hallo,
>>
>> On Fri, Oct 27, 2006 at 11:21:16AM -0700, Dylan Beaudette wrote:
>> > On Friday 27 October 2006 10:24, Jachym Cepicky wrote:
>> > > nobody tested, so i did not commit to cvs. should I commit the patch?
>> > >
>> > > jachym
>> >
>> > Hi Jachym:
>> >
>> > I will update my local grass-cvs source, and if you send me the patch
>> > (and how to apply it... i forgot...) I will test it out.
>> >
>> > Cheers,
>>
>> patch attached
>>
>> patch -d raster/r.distance < r.distance.patch
>>
>> should work
>>
>> also it would be good, if somebody would say, if the concept is all
>> right: both rasters are read twice, before the calculation starts, if
>> overlapping shall be checked: 1 for finding boundary pixels and 2 for
>> finding overlapping pixels. when I looked at the code, I could not code
>> something better.
>>
>> thanks for testing.
>>
>> jachym

> Thanks Jachym. 

> I can confirm your findings, posted on the dev list, with the spearfish60
> data:

> # from Markus' post:
> #Spearfish example:
> g.region -dp

> # extract field #25:
> r.mapcalc "myarea=if(fields == 25, 1,null())"

> # this archsite falls into field 25:
> v.extract archsites out=mypixel list=9
> v.to.rast mypixel out=mypixel use=val val=1

> ### # using new overlapping check
> GRASS 6.3.cvs (spearfish60):~ > r.distance -o --quiet mypixel,myarea fs="   "
> 1   1   0   601005   4926315   601005   4926315

> ### # without overlap check
> GRASS 6.3.cvs (spearfish60):~ > r.distance  --quiet mypixel,myarea fs="   "
> 1   1   90   601005   4926315   601095   4926315

> # digitized a new area within 'myarea' using r.digit out=testing.area
> # same results as above with the patched r.distance
> GRASS 6.3.cvs (spearfish60):~ > r.distance -o --quiet testing.area,myarea
> fs="   "
> 1   1   0   600765   4926555   600765   4926555

> (See attached screenshot, myarea is in pink, mypixel is blue, testing.area is
> in green)

> looks good to me! :) Thanks!

> This was with a fresh (10 minutes ago) update of grass6 CVS branch, with your
> recently posted patch. Note that the patch on the dev list from a while back
> did not compile.


> +1 on a commit to CVS.

> Cheers,




-- 
С уважением,
 Nomad                   





More information about the grass-user mailing list