[SCM] PostGIS branch stable-3.4 updated. 3.4.1-29-gbf05b12dd
git at osgeo.org
git at osgeo.org
Tue Jan 9 12:57:34 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.4 has been updated
via bf05b12dd396bd9b99145b1dfe53880f8f7a130b (commit)
via 43117dae2b94a8cd6a12c8850c9c9c59ca3f8598 (commit)
from b286dd218e8976bf0c9ec4629677e0f0f23f8fcc (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 bf05b12dd396bd9b99145b1dfe53880f8f7a130b
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jan 9 12:57:29 2024 -0800
Update news to reflect #5647
diff --git a/NEWS b/NEWS
index 6980c40fa..bbf28ffeb 100644
--- a/NEWS
+++ b/NEWS
@@ -11,7 +11,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.4.1+ is needed.
- #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)
commit 43117dae2b94a8cd6a12c8850c9c9c59ca3f8598
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jan 9 12:56:37 2024 -0800
Handle empty components of MULTIPOINT in native point-in-polygon routines, references #5647
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index 8871d781e..28b5c3e68 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);
@@ -1913,18 +1912,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;
@@ -2123,8 +2124,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;
@@ -2255,8 +2257,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;
@@ -2413,13 +2416,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;
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 6623d3fca..a5e9f4cc9 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1526,3 +1526,23 @@ SELECT '#5604',
FROM
ST_GeomFromText('MULTIPOINT((-2 0), EMPTY)') AS a1,
ST_GeomFromText('MULTIPOINT((1 0),(0 0))') AS a2;
+
+
+WITH g AS (
+SELECT
+ 'POINT EMPTY'::geometry AS emptypt,
+ 'MULTIPOINT(EMPTY,-392 574)'::geometry AS mixedemptypt,
+ 'POLYGON((-357 477,-392 574,-378 574,-357 477))'::geometry AS poly
+)
+SELECT '#5647' AS ticket,
+ 'intersects_empty ' || ST_Intersects(emptypt, poly),
+ 'within_empty ' || ST_Within(emptypt, poly),
+ 'contains_empty ' || ST_Contains(emptypt, poly),
+ 'coveredby_empty ' || ST_CoveredBy(emptypt, poly),
+ 'covers_empty ' || ST_Covers(poly, emptypt),
+ 'intersects_mixed_empty ' || ST_Intersects(mixedemptypt, poly),
+ 'within_mixed_empty ' || ST_Within(mixedemptypt, poly),
+ 'contains_mixed_empty ' || ST_Contains(mixedemptypt, poly),
+ 'coveredby_mixed_empty ' || ST_CoveredBy(mixedemptypt, poly),
+ 'covers_mixed_empty ' || ST_Covers(poly, mixedemptypt)
+FROM g, generate_series(1,2);
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index f9ae3a346..65c7b2993 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -470,3 +470,5 @@ ERROR: Geometry contains invalid coordinates
#5378|4269
#5627|t
#5604|2|POINT(0 0)|2|POINT(-2 0)
+#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
+#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 +-
postgis/lwgeom_geos.c | 28 +++++++++++++++-------------
regress/core/tickets.sql | 20 ++++++++++++++++++++
regress/core/tickets_expected | 2 ++
4 files changed, 38 insertions(+), 14 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list