Changeset: ac104da54ed2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=ac104da54ed2
Modified Files:
geom/monetdb5/geom.c
Branch: geo
Log Message:
BdPolygonFromText check for valid polygon
diffs (40 lines):
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -1330,17 +1330,35 @@ str wkbMLineStringToPolygon(wkb** geomWK
finalGeometry =
GEOSGeom_createPolygon(linearRingExternalGeometry, internalGeometries,
itemsNum-1);
if(finalGeometry == NULL) {
GEOSGeom_destroy(linearRingExternalGeometry);
+ for(i=0; i<itemsNum; i++)
+ GEOSGeom_destroy(internalGeometries[i]);
+ GDKfree(internalGeometries);
*geomWKB = wkb_nil;
throw(MAL, "geom.MLineStringToPolygon", "Error creating
Polygon from LinearRing");
}
+ //check of the created polygon is valid
+ if(GEOSisValid(finalGeometry) != 1) {
+ //suppress the GEOS message
+ if (GDKerrbuf)
+ GDKerrbuf[0] = '\0';
+
+ GEOSGeom_destroy(finalGeometry);
+ GDKfree(internalGeometries);
+
+ *geomWKB = wkb_nil;
+ throw(MAL, "geom.MLineStringToPolygon", "The provided
MultiLineString does not create a valid Polygon");
+
+ }
+
GEOSSetSRID(finalGeometry, *srid);
*geomWKB = geos2wkb(finalGeometry);
GEOSGeom_destroy(finalGeometry);
GDKfree(internalGeometries);
} else if(*flag == 1) {
- //} else {
+
+ } else {
*geomWKB = wkb_nil;
throw(MAL, "geom.MLineStringToPolygon", "Uknown flag");
}
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list