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

Hamish hamish_nospam at yahoo.com
Tue Jun 1 00:38:22 EDT 2004


I've just changed the v.to.rast man pages to document this, but after
some more experimentation I'm more convinced that there's a bug in the
5.7 version.

quoting my additions:
http://freegis.org/cgi-bin/viewcvs.cgi/*checkout*/grass51/vector/v.to.rast/description.html

[... only labeled items will be converted]

# Labeled areas and/or centroids will produce filled raster coverages
  with edges that straddle the original area boundary **as long as the 
  boundary is NOT labeled**.
  (Use v.category option=del type=boundary to remove.)

# Labeled lines and boundaries will produce lines of raster cells which
  touch the original vector line. This tends to be more aggressive than
  area-only conversions.

# Points and orphaned centroids will be converted into single cells on
  the resultant raster map.


Specifically, lines will not know which side is in or out so they must
tag all cells they pass through for any significant distance. Boundaries
on the other hand should know which side is in/out and only tag cells
whose center points are inside the area. Currently boundary->raster
conversions act line line->raster which I think is wrong.

You only see this in 5.3 if you have run v.llabel on a vector containing
area features, and now that it is documented in the help page, no
problem. 

Creating a new area with 5.7's v.digit labels the boundary by default so
this pops up a lot more often.


?
Hamish



On Wed, 26 May 2004 03:21:11 +1200
Hamish <hamish_nospam at yahoo.com> wrote:

> 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