[GRASS-dev] Re: [GRASS-user] v.buffer bug??

Hamish wrote:

Düster Horst wrote:

When I buffer the attached line layer with 250 mapunits I get an
unsiutable result. Take a look of the buffer_error.png image. You will
see that the line at the mean right wasn't buffered correct. To
reproduce this behavior I attach the original line layer.

GRASS-6.1.0

This is a known bug, see the BUGS section in the v.buffer help page.

Work-around 1: make a buffer half the size, then buffer the result a
second time.

That is (too)often not a solution. v.buffer is buggy in an
unpredictable way.

See the attached screendumps.

ditches.png is a dump of my vector 'ditches'. It is an all OK vector,
1-2m wide, topologically clean areas, each with categories and
attributes. See how it is buffered in 2 next cases (metric projection):

ditches_buf_1m.png is an output of:
v.buffer input=ditches output=ditches_buf_1m type=area buffer=1

ditches_buf_4m.png is an output of:
v.buffer input=ditches output=ditches_buf_4m type=area buffer=4

Work-around 2: v.to.rast, r.buffer, r.to.vect

Luckily this works as supposed to, but is not always appropriate. Take
this case of mine for example - creating a nice 1m or 0.5m raster
buffer around my 'ditches' takes going down to an extremely high
resolution=long processing time, and no matter how high the res the
result is never as good as it could be with v.buffer bug-free.

Not only buffering areas is buggy. Buffering lines is as much
unpredictable. See:

http://www.biol.uni.wroc.pl/sieczka/udostepnione/grass/corrupted_buffer_of_a_line.png

(background for this dump is explained in
http://intevation.de/rt/webrt?serial_num=2765)

Stating the obvious, no reliable buffering for vectors in Grass is a
dramatic problem.

Maciek

(attachments)

ditches.png
ditches_buf_2m.png
ditches_buf_4m.png

Bug log:

http://intevation.de/rt/webrt?serial_num=2765

Hi,

I have a patch I think gets around the famous v.buffer bug (attached),
please test.

I say "gets around" the bug more than solves it, as while I know that
the bug happens when the "sa" segment loops back to "0" and then the
total number of points is set by the final segment number(+2), I don't
really know why, or if this is the problem or the problem is the setting
of npn (total number of points) directly from the seg ID number.
[ lib/vector/Vlib/buffer.c clean_parallel() ]

So this patch just makes sure that we don't set npn from a smaller "sa"
value than was found in the data.

This fixes the buffer for the test polygon found in the bug log.
I don't know if it fixes the hole-gets-filled-in area problem.

Hamish

(attachments)

fix_vbuf.diff (1.01 KB)

thanks hamish,

will try it out on the latest CVS,

PS: pardon my stupidity, but how would i apply this patch (forgot!)

Dylan

On 10/1/06, Hamish <hamish_nospam@yahoo.com> wrote:

Bug log:
> http://intevation.de/rt/webrt?serial_num=2765

Hi,

I have a patch I think gets around the famous v.buffer bug (attached),
please test.

I say "gets around" the bug more than solves it, as while I know that
the bug happens when the "sa" segment loops back to "0" and then the
total number of points is set by the final segment number(+2), I don't
really know why, or if this is the problem or the problem is the setting
of npn (total number of points) directly from the seg ID number.
[ lib/vector/Vlib/buffer.c clean_parallel() ]

So this patch just makes sure that we don't set npn from a smaller "sa"
value than was found in the data.

This fixes the buffer for the test polygon found in the bug log.
I don't know if it fixes the hole-gets-filled-in area problem.

Hamish

_______________________________________________
grassuser mailing list
grassuser@grass.itc.it
http://grass.itc.it/mailman/listinfo/grassuser

Dylan Beaudette wrote:

> > http://intevation.de/rt/webrt?serial_num=2765
>
> Hi,
>
> I have a patch I think gets around the famous v.buffer bug
> (attached), please test.

..

will try it out on the latest CVS,

PS: pardon my stupidity, but how would i apply this patch (forgot!)

cd /where/grass/is/
patch -p0 < patch.diff
cd lib/vector/Vlib/
make

or if that doesn't work and it's small patch like this one, just make
the changes by hand.

Hamish

Thanks Hamish,

I have applied the patch, and run v.buffer on a sample data set, and all seems
to be well. however my sample data was a set of line segments: and not areas,
as was the case with Macieck.

Perhaps this test case is known.

Cheers,

Dylan

On Sunday 01 October 2006 18:23, Hamish wrote:

Dylan Beaudette wrote:
> > > http://intevation.de/rt/webrt?serial_num=2765
> >
> > Hi,
> >
> > I have a patch I think gets around the famous v.buffer bug
> > (attached), please test.

..

> will try it out on the latest CVS,
>
> PS: pardon my stupidity, but how would i apply this patch (forgot!)

cd /where/grass/is/
patch -p0 < patch.diff
cd lib/vector/Vlib/
make

or if that doesn't work and it's small patch like this one, just make
the changes by hand.

Hamish

--
Dylan Beaudette
Soils and Biogeochemistry Graduate Group
University of California at Davis
530.754.7341