[SCM] PostGIS branch stable-3.3 updated. 3.3.5-18-gc7dfd59c9

git at osgeo.org git at osgeo.org
Tue Jan 9 14:21:24 PST 2024


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "PostGIS".

The branch, stable-3.3 has been updated
       via  c7dfd59c93389168f514ae2d766e37b71cec5387 (commit)
      from  444df47713aecd408f76509a783567564d737bd1 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c7dfd59c93389168f514ae2d766e37b71cec5387
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jan 9 14:21:16 2024 -0800

    Fix ST_Covers mixed p-i-p case, #5647

diff --git a/NEWS b/NEWS
index 2ad750011..0f7117150 100644
--- a/NEWS
+++ b/NEWS
@@ -10,7 +10,7 @@ Proj 6.1+, and PostgreSQL 15+.
  - #5571, Memory over-allocation for narrow inputs (Paul Ramsey)
  - #5610, Regression fix: Allow Nan and infinity again
           in ST_SetPoint (Regina Obe)
- - #5627, Handling of EMPTY components in PiP check (Paul Ramsey)
+ - #5627, #5647, Handling of EMPTY components in PiP check (Paul Ramsey)
  - #5629, Handling EMPTY components in repeated point removal (Paul Ramsey)
  - #5604, Handle distance between collections with empty elements (Paul Ramsey)
  - #5635, Handle NaN points in ST_Split (Regina Obe)
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 5dd5dd96c..f183fb691 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -140,7 +140,6 @@ static int
 pip_short_circuit(RTREE_POLY_CACHE *poly_cache, LWPOINT *point, const GSERIALIZED *gpoly)
 {
 	int result;
-
 	if ( poly_cache && poly_cache->ringIndices )
 	{
         result = point_in_multipolygon_rtree(poly_cache->ringIndices, poly_cache->polyCount, poly_cache->ringCounts, point);
@@ -1789,18 +1788,20 @@ Datum contains(PG_FUNCTION_ARGS)
 		else if (gserialized_get_type(gpoint) == MULTIPOINTTYPE)
 		{
 			LWMPOINT* mpoint = lwgeom_as_lwmpoint(lwgeom_from_gserialized(gpoint));
-			uint32_t i;
 			int found_completely_inside = LW_FALSE;
 
 			retval = LW_TRUE;
-			for (i = 0; i < mpoint->ngeoms; i++)
+			for (uint32_t i = 0; i < mpoint->ngeoms; i++)
 			{
+				int pip_result;
+				LWPOINT* pt = mpoint->geoms[i];
 				/* We need to find at least one point that's completely inside the
 				 * polygons (pip_result == 1).  As long as we have one point that's
 				 * completely inside, we can have as many as we want on the boundary
 				 * itself. (pip_result == 0)
 				 */
-				int pip_result = pip_short_circuit(cache, mpoint->geoms[i], gpoly);
+				if (lwpoint_is_empty(pt)) continue;
+				pip_result = pip_short_circuit(cache, pt, gpoly);
 				if (pip_result == 1)
 					found_completely_inside = LW_TRUE;
 
@@ -1999,8 +2000,9 @@ Datum covers(PG_FUNCTION_ARGS)
 			retval = LW_TRUE;
 			for (i = 0; i < mpoint->ngeoms; i++)
 			{
-				int pip_result = pip_short_circuit(cache, mpoint->geoms[i], gpoly);
-				if (pip_result == -1)
+				LWPOINT *pt = mpoint->geoms[i];
+				if (lwpoint_is_empty(pt)) continue;
+				if (pip_short_circuit(cache, pt, gpoly) == -1)
 				{
 					retval = LW_FALSE;
 					break;
@@ -2131,8 +2133,9 @@ Datum coveredby(PG_FUNCTION_ARGS)
 			retval = LW_TRUE;
 			for (i = 0; i < mpoint->ngeoms; i++)
 			{
-				int pip_result = pip_short_circuit(cache, mpoint->geoms[i], gpoly);
-				if (pip_result == -1)
+				LWPOINT *pt = mpoint->geoms[i];
+				if (lwpoint_is_empty(pt)) continue;
+				if (pip_short_circuit(cache, pt, gpoly) == -1)
 				{
 					retval = LW_FALSE;
 					break;
@@ -2289,13 +2292,12 @@ Datum ST_Intersects(PG_FUNCTION_ARGS)
 		else if (gserialized_get_type(gpoint) == MULTIPOINTTYPE)
 		{
 			LWMPOINT* mpoint = lwgeom_as_lwmpoint(lwgeom_from_gserialized(gpoint));
-			uint32_t i;
-
 			retval = LW_FALSE;
-			for (i = 0; i < mpoint->ngeoms; i++)
+			for (uint32_t i = 0; i < mpoint->ngeoms; i++)
 			{
-				int pip_result = pip_short_circuit(cache, mpoint->geoms[i], gpoly);
-				if (pip_result != -1) /* not outside */
+				LWPOINT *pt = mpoint->geoms[i];
+				if (lwpoint_is_empty(pt)) continue;
+				if (pip_short_circuit(cache, pt, gpoly) != -1) /* not outside */
 				{
 					retval = LW_TRUE;
 					break;

-----------------------------------------------------------------------

Summary of changes:
 NEWS                  |  2 +-
 postgis/lwgeom_geos.c | 28 +++++++++++++++-------------
 2 files changed, 16 insertions(+), 14 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list