[SCM] PostGIS branch master updated. 3.4.0rc1-876-g6f6333755

git at osgeo.org git at osgeo.org
Tue Jan 9 14:20:07 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, master has been updated
       via  6f63337551d63fcca94e44fa5c6a26adea48242a (commit)
      from  51ff306d3f32217d00e9511cfe9463ddb0523adb (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 6f63337551d63fcca94e44fa5c6a26adea48242a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jan 9 14:20:03 2024 -0800

    Fix behaviour in ST_Covers, references #5647;

diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 4371eb7b3..192d395a5 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -1874,18 +1874,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;
 
@@ -2084,8 +2086,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;
@@ -2216,8 +2219,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;
@@ -2374,13 +2378,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:
 postgis/lwgeom_geos.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list