[SCM] PostGIS branch stable-3.1 updated. 3.1.10-14-ge64ae3be8
git at osgeo.org
git at osgeo.org
Tue Jan 9 14:22:44 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.1 has been updated
via e64ae3be8b57e1948210afe5df0c46274dc0c039 (commit)
from 871d365dfb421f886490a766a2a212ac9be0a123 (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 e64ae3be8b57e1948210afe5df0c46274dc0c039
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jan 9 14:22:38 2024 -0800
Fix ST_Covers mixed p-i-p case, references #5647
diff --git a/NEWS b/NEWS
index 5cf2268dd..e7a56f002 100644
--- a/NEWS
+++ b/NEWS
@@ -4,7 +4,7 @@ xxxx/xx/xx
* Bug Fixes *
- #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)
- #5604, Handle distance between collections with empty elements (Paul Ramsey)
- #5635, Handle NaN points in ST_Split (Regina Obe)
- Logic error in ST_Covers(geography) (Paul Ramsey)
diff --git a/postgis/lwgeom_geos.c b/postgis/lwgeom_geos.c
index a6fbcd899..4cd0b36a9 100644
--- a/postgis/lwgeom_geos.c
+++ b/postgis/lwgeom_geos.c
@@ -142,7 +142,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);
@@ -1893,18 +1892,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;
@@ -2103,8 +2104,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;
@@ -2235,8 +2237,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;
@@ -2393,13 +2396,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