Changeset: 7da8fac9cfe9 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/7da8fac9cfe9
Modified Files:
geom/monetdb5/geom.c
Branch: geo-update
Log Message:
Fixes bug in geoDistanceSingle() for comparison between Line and Polygon
The polygon geometries do not calculate their bounding boxes at
initialization so the .bbox is NULL. Then .bbox have to be calculate
explicitly before geoDistanceLinePolygon() calls to avoid a SIGSEGV in
pointOutsidePolygon() where we dereference the .bbox
diffs (31 lines):
diff --git a/geom/monetdb5/geom.c b/geom/monetdb5/geom.c
--- a/geom/monetdb5/geom.c
+++ b/geom/monetdb5/geom.c
@@ -745,12 +745,18 @@ geoDistanceSingle(GEOSGeom aGeom, GEOSGe
/* Line/LinearRing and Polygon */
GeoLines a = geoLinesFromGeom(aGeom);
GeoPolygon b = geoPolygonFromGeom(bGeom);
+ // If the geometry doesn't have BoundingBoxe, calculate it
+ if (b.bbox == NULL)
+ b.bbox = boundingBoxLines(b.exteriorRing);
distance = geoDistanceLinePolygon(a, b);
freeGeoLines(a);
freeGeoPolygon(b);
} else if (dimA == 2 && dimB == 1) {
/* Polygon and Line/LinearRing */
GeoPolygon a = geoPolygonFromGeom(aGeom);
+ // If the geometry doesn't have BoundingBoxe, calculate it
+ if (a.bbox == NULL)
+ a.bbox = boundingBoxLines(a.exteriorRing);
GeoLines b = geoLinesFromGeom(bGeom);
distance = geoDistanceLinePolygon(b, a);
freeGeoPolygon(a);
@@ -759,7 +765,7 @@ geoDistanceSingle(GEOSGeom aGeom, GEOSGe
/* Polygon and Polygon */
GeoPolygon a = geoPolygonFromGeom(aGeom);
GeoPolygon b = geoPolygonFromGeom(bGeom);
- //If the geometry don't have BoundingBoxes, calculate them
+ // If the geometries don't have BoundingBoxes, calculate them
if (a.bbox == NULL)
a.bbox = boundingBoxLines(a.exteriorRing);
if (b.bbox == NULL)
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list