[geos-devel] Problems with BufferOp when using BufferParameters

Markus Meyer meyer at mesw.de
Wed Oct 26 06:14:59 EDT 2011


Hi everyone,

I'm using GEOS 3.3.0 on Microsoft Visual Studio 2008 (Windows 7) for 
buffering lines using BufferOp.

I would like to use the BufferParameters class to control extended 
parameters. However, it seems that I must be using the BufferOp class 
the wrong way because my parameters are never accepted. To explain this, 
I created a simple test program which offsets a rectangle.

When I do the buffering with the static function Buffer::bufferOp() the 
resulting geometry looks OK:

     // Working code
     geos::geom::Polygon* pPolygon = dynamic_cast<geos::geom::Polygon*>(
         geos::operation::buffer::BufferOp::bufferOp(
             pLineString, fOffset, 16,
             geos::operation::buffer::BufferParameters::CAP_ROUND));

When I do the buffering by using the BufferOp and BufferParameters class 
directly, the resulted geometry looks very strange:

     // Not working code
     geos::operation::buffer::BufferParameters params(
         16,
         geos::operation::buffer::BufferParameters::CAP_ROUND);

     geos::operation::buffer::BufferOp op(pLineString, params);
     geos::geom::Polygon* pPolygon =
         dynamic_cast<geos::geom::Polygon*>(op.getResultGeometry(fOffset));

 From my understanding, the results of both code snipets should be the same.

Here you can find a plot of the results in both cases:

http://www.mesw.de/support/geos_rectangle_buffer_fail.png

Any help is greatly appreciated.

Best regards,
Markus

-------------- next part --------------
A non-text attachment was scrubbed...
Name: geos_rectangle_buffer_fail.png
Type: image/png
Size: 26606 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/geos-devel/attachments/20111026/a94bf316/geos_rectangle_buffer_fail-0001.png


More information about the geos-devel mailing list