[SCM] PostGIS branch stable-3.1 updated. 3.1.10-9-g8b079c48f

git at osgeo.org git at osgeo.org
Fri Dec 1 15:58:02 PST 2023


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  8b079c48fedd3021633903994d9d67c6fbc9b911 (commit)
       via  61ce8ba11c7c472c99cb7ce164c2865f4fbe368d (commit)
      from  ff5b8ac877ea174976e14403abeb9fcffcc0d9b4 (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 8b079c48fedd3021633903994d9d67c6fbc9b911
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:45:36 2023 -0800

    News item for #5604

diff --git a/NEWS b/NEWS
index e6072c874..40cac7425 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,8 @@ xxxx/xx/xx
  - #5610, Regression fix: Allow Nan and infinity again
           in ST_SetPoint (Regina Obe)
  - #5627, Handling of EMPTY components in PiP check (Paul Ramsey)
+ - #5604, Handle distance between collections with empty elements (Paul Ramsey)
+
 
 PostGIS 3.1.10
 2023/11/19

commit 61ce8ba11c7c472c99cb7ce164c2865f4fbe368d
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:32:28 2023 -0800

    Correctly handle distances between collections with empty elements, references #5604

diff --git a/liblwgeom/measures.c b/liblwgeom/measures.c
index 6ee9e3426..2484e9d16 100644
--- a/liblwgeom/measures.c
+++ b/liblwgeom/measures.c
@@ -299,7 +299,7 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 			g1 = (LWGEOM *)lwg1;
 
 		if (lwgeom_is_empty(g1))
-			return LW_TRUE;
+			continue;
 
 		if (lw_dist2d_is_collection(g1))
 		{
@@ -329,10 +329,9 @@ lw_dist2d_recursive(const LWGEOM *lwg1, const LWGEOM *lwg2, DISTPTS *dl)
 			if (!g2->bbox)
 				lwgeom_add_bbox(g2);
 
-			/* If one of geometries is empty, return. True here only means continue searching. False would
-			 * have stopped the process*/
+			/* If one of geometries is empty, skip */
 			if (lwgeom_is_empty(g1) || lwgeom_is_empty(g2))
-				return LW_TRUE;
+				continue;
 
 			if ((dl->mode != DIST_MAX) && (!lw_dist2d_check_overlap(g1, g2)) &&
 			    (g1->type == LINETYPE || g1->type == POLYGONTYPE || g1->type == TRIANGLETYPE) &&
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index e8a30e119..a2e8eb08a 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1459,3 +1459,12 @@ FROM (VALUES
     ('MULTIPOLYGON(((-357 477,-392 574,-378 574,-357 477)))'::geometry),
     ('MULTIPOLYGON(((-357 477,-392 574,-378 574,-357 477)))'::geometry))
     AS geoms(geom);
+
+SELECT '#5604',
+ ST_Distance(a2, a1),
+ ST_AsText(ST_ClosestPoint(a2, a1)),
+ ST_Distance(a1, a2),
+ ST_AsText(ST_ClosestPoint(a1, a2))
+FROM
+ST_GeomFromText('MULTIPOINT((-2 0), EMPTY)') AS a1,
+ST_GeomFromText('MULTIPOINT((1 0),(0 0))') AS a2;
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index d9409b737..14ed34273 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -462,3 +462,4 @@ ERROR:  Line has no points
 ERROR:  Geometry contains invalid coordinates
 ERROR:  Geometry contains invalid coordinates
 #5627|t
+#5604|2|POINT(0 0)|2|POINT(-2 0)

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

Summary of changes:
 NEWS                          | 2 ++
 liblwgeom/measures.c          | 7 +++----
 regress/core/tickets.sql      | 9 +++++++++
 regress/core/tickets_expected | 1 +
 4 files changed, 15 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list