[SCM] PostGIS branch stable-3.3 updated. 3.3.5-11-g5b5040219

git at osgeo.org git at osgeo.org
Fri Dec 1 15:57:51 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.3 has been updated
       via  5b5040219a9801c7022f19666b09c5a7a467c568 (commit)
       via  63b123db9dd5a8c5ae0cfae4ac9139f37e3db8f3 (commit)
      from  9170776205f59d14f9db219232dcf79fb91890ef (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 5b5040219a9801c7022f19666b09c5a7a467c568
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Dec 1 15:44:03 2023 -0800

    News item for #5604

diff --git a/NEWS b/NEWS
index bd4ac005a..cfb6df37f 100644
--- a/NEWS
+++ b/NEWS
@@ -12,6 +12,7 @@ Proj 6.1+, and PostgreSQL 15+.
           in ST_SetPoint (Regina Obe)
  - #5627, 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)
 
 
 PostGIS 3.3.5

commit 63b123db9dd5a8c5ae0cfae4ac9139f37e3db8f3
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 6f3c22fc1..ef71f5f86 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1487,3 +1487,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 71ebd17d4..d4ddf78da 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -457,3 +457,4 @@ ERROR:  Geometry contains invalid coordinates
 ERROR:  Geometry contains invalid coordinates
 #5378|4269
 #5627|t
+#5604|2|POINT(0 0)|2|POINT(-2 0)

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

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


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list