[geos-devel] Problems with BufferOp when using BufferParameters
Mateusz Łoskot
mateusz at loskot.net
Wed Oct 26 14:56:41 EDT 2011
On 26 October 2011 11:14, Markus Meyer <meyer at mesw.de> wrote:
>
> 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.
Markus,
As Sandro confirmed, both ways should produce the same results.
I have added test case that tries to reproduce your use case.
Here it is:
http://trac.osgeo.org/geos/changeset/3509
It is based on one of test geometries used across the GEOS unit tests.
If you can provide your geometry, it would be helpful.
Then we could replace the WKT input in the test and have it covered.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Member of ACCU, http://accu.org
More information about the geos-devel
mailing list