From: Sandro Santilli Date: Fri, 6 Mar 2015 10:35:58 +0000 (+0000) Subject: Fix ST_ClipByBox2D after gbox calculations centralization (r13313) X-Git-Tag: 2.2.0rc1~610 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4eef016324aa8f4a8362c82a27a5fa1e611a3645;p=postgis Fix ST_ClipByBox2D after gbox calculations centralization (r13313) See #3073 git-svn-id: http://svn.osgeo.org/postgis/trunk@13320 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c index dcf735211..825d1897c 100644 --- a/postgis/lwgeom_geos.c +++ b/postgis/lwgeom_geos.c @@ -1679,7 +1679,8 @@ Datum ST_ClipByBox2d(PG_FUNCTION_ARGS) bbox2 = (GBOX *)PG_GETARG_POINTER(1); /* If bbox1 outside of bbox2, return empty */ - if ( ! gbox_overlaps_2d(bbox1, bbox2) ) + if ( bbox1->xmin > bbox2->xmax || bbox1->xmax < bbox2->xmin || + bbox1->ymin > bbox2->ymax || bbox1->ymax < bbox2->ymin ) { lwresult = lwgeom_construct_empty(lwgeom1->type, lwgeom1->srid, 0, 0); lwgeom_free(lwgeom1); @@ -1690,7 +1691,8 @@ Datum ST_ClipByBox2d(PG_FUNCTION_ARGS) } /* if bbox1 is covered by bbox2, return lwgeom1 */ - if ( gbox_contains_2d(bbox2, bbox1) ) + if ( bbox1->xmax <= bbox2->xmax && bbox1->xmin >= bbox2->xmin && + bbox1->ymax <= bbox2->ymax && bbox1->ymin >= bbox2->ymin ) { lwgeom_free(lwgeom1); PG_RETURN_POINTER(geom1);