First and last segments of a closed linestring are not rendered when using a positive line offset
Tamas Szekeres
szekerest at gmail.com
Tue Nov 5 11:35:40 PST 2024
Hi,
I'm experiencing an issue that the first and the last segment is missing
when using offestCurve on a closed linestring. It is relatively easy to
reproduce that issue, using the following code sample which results a
geometry of 3 points instead of 5:
// Create the LINESTRING
GEOSCoordSequence* sequence = GEOSCoordSeq_create_r(handle, 5, 2);
GEOSCoordSeq_setXY_r(handle, sequence, 0, 252.68873929007674,
411.71254313074394);
GEOSCoordSeq_setXY_r(handle, sequence, 1, 505.82866421616694,
411.71254313074394);
GEOSCoordSeq_setXY_r(handle, sequence, 2, 505.82866421616694,
158.57261820465371);
GEOSCoordSeq_setXY_r(handle, sequence, 3, 252.68873929007674,
158.57261820465371);
GEOSCoordSeq_setXY_r(handle, sequence, 4, 252.68873929007674,
411.71254313074394); // Closing the LINESTRING
GEOSGeometry* line = GEOSGeom_createLineString_r(handle, sequence);
// Set the offset and other parameters
double offset = 5.0;
GEOSBufJoinStyles joinStyle = GEOSBUF_JOIN_MITRE;
double mitreLimit = fabs(offset * 1.5);
// Apply the offset curve
GEOSGeometry* offsetResult = GEOSOffsetCurve_r(handle, line, offset, 4,
joinStyle, mitreLimit);
I've checked that this behavior was introduced in 3.11.0 (3.10.6 was OK)
and it still exists in the latest stable branch.
Similar issue has already been reported against qgis in the following
ticket:
https://github.com/qgis/QGIS/issues/51583
Do we have a workaround or plans to fix this issue?
Thanks,
Tamas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/geos-devel/attachments/20241105/c1b24a13/attachment.htm>
More information about the geos-devel
mailing list