[GRASS-dev] r.distance problem: in our out?
Markus Neteler
neteler at itc.it
Mon May 28 09:50:53 EDT 2007
Hi,
backported to GRASS 6.2-CVS for 6.2.2.
Markus
hallo,
Dylan tested and found no error. Patch commited, r.distance has -o flag
for taking care on overlapping rasters
jachym
On Tue, Oct 10, 2006 at 03:33:56PM +0200, Jachym Cepicky wrote:
> hallo,
>
> On Wed, Oct 04, 2006 at 01:38:25PM +0200, Markus Neteler wrote:
> > Hi,
> >
> > for an application I have to calculate the distance between
> > raster "objects". While this generally works, I have found
> > that r.distance happily calculates the distance even if
> > one object is within the other (say, raster pixel over
> > raster polygon in second map). I would need an indication
> > somehow that we are *in* (to ignore the distance in this
> > case).
>
> i did not found any G_is_null(raster_map_name,x,y) or similar function.
> is there something like this?
>
> thank you
>
> jachym
>
> one cell from mypixel is "surrounded"
> >
> > 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
> > r.distance mypixel,myarea
> > # -> reports two distant points
> >
> > # zoom:
> > g.region n=4926990 s=4925856 w=599850 e=601376 align=myarea
> > d.mon x0
> > d.rast myarea
> > d.vect mypixel col=blue
> > # visualize distance (d.graph give sometimes random output!):
> > r.distance mypixel,myarea | awk -F: '{print
> "move",$4,$5,"\ndraw",$6,$7}' | d.graph -m
> >
> > # generate points from distance for easier verification:
> > r.distance mypixel,myarea | awk -F: '{print $4,"|",$5,"\n",$6,"|",$7}' |
> sed 's+ ++g' | v.in.ascii out=distance
> > d.vect distance col=yellow
> >
> > # cleanup:
> > g.remove rast=myarea,mypixel
> > g.remove vect=mypixel,distance
> >
> > ###
> > Problem: There is no indication that we are *within* the area. Maybe a
> flag is
> > needed to optionally suppress the result in this case?
> > Better ideas?
> >
> > Second problem: The result seems to be underestimated by half a cell
> > since not the cell edge is taken from the raster polygon boundary
> > but the cell center.
> >
> > Appreciating help,
> > Markus
>
> --
> Jachym Cepicky
> e-mail: jachym.cepicky at centrum.cz
> URL: http://les-ejk.cz
> GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
> -----------------------------------------
> OFFICE:
> Department of Geoinformation Technologies
> Zemedelska 3
> 613 00, Brno
> Czech Republick
> e-mail: xcepicky at node.mendelu.cz
> URL: http://mapserver.mendelu.cz
> Tel.: +420 545 134 514
--
Jachym Cepicky
e-mail: jachym.cepicky at centrum.cz
URL: http://les-ejk.cz
GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
-----------------------------------------
OFFICE:
Department of Geoinformation Technologies
Zemedelska 3
613 00, Brno
Czech Republick
e-mail: xcepicky at node.mendelu.cz
URL: http://mapserver.mendelu.cz
Tel.: +420 545 134 514
--
View this message in context: http://www.nabble.com/r.distance-problem%3A-in-our-out--tf2381876.html#a10836579
Sent from the Grass - Dev mailing list archive at Nabble.com.
More information about the grass-dev
mailing list