[GRASS5] Re: [GRASSLIST:2585] Re: v.to.rast aggressiveness

Hamish hamish_nospam at yahoo.com
Tue May 25 11:21:11 EDT 2004


On Tue, 13 Apr 2004 14:45:12 +0200
Radim Blazek <blazek at itc.it> wrote:

> On Sunday 11 April 2004 10:48, Hamish wrote:
> > On Fri, 13 Feb 2004 01:51:56 +1300 Hamish wrote:
> >   http://grass.itc.it/pipermail/grassuser/2004-February/024709.html
> >
> > > > I'm noticing v.to.rast is rather aggressive -- (all versions
> > > > 5.0,5.3,5.7)
> > > >
> > > > It will change many raster cells with only a little bit of
> > > > vector line in it to a hit, rather than checking which side of
> > > > the cell's centroid the area is on..?
> > > >
> > > > This has bad implications if you want to create masks covering
> > > > areas both one side or the other, as it will always bias towards
> > > > the side of the area vs. the negative. (say in/out of a lake's
> > > > shoreline)
> >
> > Glynn wrote:
> > > I find that rather odd, as G_plot_polygon() appears to shrink the
> > > polygon which it is given.
> > >
> > > AFAICT, much of src/libes/gis.c is bogus; it should probably be
> > > using floor(x + 0.5) consistently. However, given my experience
> > > from XDRIVER[1], I'm reluctant to try to fix it, as there is
> > > probably code which relies upon the existing behaviour.
> > >
> > > [1] XDRIVER, libraster, libdisplay and various d.* programs had a
> > > number of +1/-1 "fudge" factors, which mostly cancelled each other
> > > out. Once I fixed one, I had to go back up the chain and fix
> > > anything which was relying upon the old behaviour.
> >
> > I'm having another try at this and it appears the problem goes away
> > if I export the vector file to 5.3 (& run v.alabel and v.support).
> > This solves my immediate problem.
> >
> > I'm not sure at this point what I was doing to make it show up in
> > 5.0 & 5.3 before or if I was mistaken or something else is different
> > now. Maybe the date had something to do with it.
> >
> > Trying with 5.7 from last week still produces bad results.
> >
> > see attached before & after pics. v2rast_1.png is using 5.7's
> > v.to.rast, v2rast_3.png is using 5.3's version.
> >
> > Can someone confirm? Is this a 5.7 vector bug?
> 
> Are you sure the boundary is not used? If you want only the area, 
> the boundary must not have a category of the field used in v.to.rast.


Yes, that's it.

Running v.to.rast on a v.in.ascii + 'v.support -r' [5.3] file without
any Category info you get no output.

(a) After running v.alabel on that, you get what I was aiming for, i.e.
output raster straddles the boundary line.

(b) After running v.alabel + v.llabel on that, you end up with what I
was getting, a "hull" of the vector file.

(c) If you only run v.llabel on the vector, you will get a raster line
which straddles the boundary line. 

Note  c != patch(a,b)  !!


so I guess it's a feature, not a bug, but not terribly intuitive ...?

If this is in fact the expected behavior, the man pages should be
updated to include this info.



Hamish




More information about the grass-dev mailing list