[SCM] PostGIS branch stable-3.0 updated. 3.0.10-8-g0437cc0f2

git at osgeo.org git at osgeo.org
Fri Dec 1 15:57:58 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.0 has been updated
       via  0437cc0f206c76b2ac428656fa98729468c451f1 (commit)
       via  e5dec40ba95b6d6cb473b5b20e91996fe2c6e6aa (commit)
      from  ea968b9e0b5640cae61c8e5a972088679fedb6a6 (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 0437cc0f206c76b2ac428656fa98729468c451f1
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:46:19 2023 -0800

    News item for #5604

diff --git a/NEWS b/NEWS
index 7d219101d..47256754b 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,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.0.10
 2023/11/19

commit e5dec40ba95b6d6cb473b5b20e91996fe2c6e6aa
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 7ddecc41a..4756d99b8 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1401,3 +1401,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 ba9ed4075..4e8b02c63 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -458,3 +458,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