Skip to content
Permalink
Browse files
Fix issue #5529 about GEOS error with offset on MULTILINESTRING
  • Loading branch information
github-actions[bot] committed Jun 4, 2020
1 parent 04402a4 commit c894eda521b49f54396b551f4538f96a638ce875
Showing 1 changed file with 16 additions and 1 deletion.
@@ -804,7 +804,22 @@ shapeObj *msGEOSOffsetCurve(shapeObj *p, double offset) {
g1 = (GEOSGeom) p->geometry;
if(!g1) return NULL;

g2 = GEOSOffsetCurve_r(handle,g1, offset, 4, GEOSBUF_JOIN_MITRE, fabs(offset*1.5));
if (GEOSGeomTypeId_r(handle,g1) == GEOS_MULTILINESTRING)
{
GEOSGeom *lines = malloc(p->numlines*sizeof(GEOSGeom));
if (!lines) return NULL;
for(int i=0; i<p->numlines; i++)
{
lines[i] = GEOSOffsetCurve_r(handle, GEOSGetGeometryN_r(handle,g1,i),
offset, 4, GEOSBUF_JOIN_MITRE, fabs(offset*1.5));
}
g2 = GEOSGeom_createCollection_r(handle,GEOS_MULTILINESTRING, lines, p->numlines);
free(lines);
}
else
{
g2 = GEOSOffsetCurve_r(handle,g1, offset, 4, GEOSBUF_JOIN_MITRE, fabs(offset*1.5));
}
return msGEOSGeometry2Shape(g2);
#else
msSetError(MS_GEOSERR, "GEOS Offset Curve support is not available.", "msGEOSingleSidedBuffer()");

0 comments on commit c894eda

Please sign in to comment.