[SCM] PostGIS branch master updated. 3.5.0alpha2-19-gcc1f1c260

git at osgeo.org git at osgeo.org
Fri Aug 2 16:29:21 PDT 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, master has been updated
       via  cc1f1c260f49948fa01c050f25f85d486194a28c (commit)
      from  e734cac9b58fed05ec1729f47ca53be0f58f296d (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 cc1f1c260f49948fa01c050f25f85d486194a28c
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Fri Aug 2 16:29:15 2024 -0700

    Error in ST_DistanceSpheroid due to planar box leaking into geodetic code, references #5740

diff --git a/liblwgeom/lwgeodetic.c b/liblwgeom/lwgeodetic.c
index 0a1cac924..85953c7bc 100644
--- a/liblwgeom/lwgeodetic.c
+++ b/liblwgeom/lwgeodetic.c
@@ -2088,13 +2088,13 @@ double lwgeom_distance_spheroid(const LWGEOM *lwgeom1, const LWGEOM *lwgeom2, co
 	type2 = lwgeom2->type;
 
 	/* Make sure we have boxes */
-	if ( lwgeom1->bbox )
+	if ( FLAGS_GET_GEODETIC(lwgeom1->flags) && lwgeom1->bbox )
 		gbox1 = *(lwgeom1->bbox);
 	else
 		lwgeom_calculate_gbox_geodetic(lwgeom1, &gbox1);
 
 	/* Make sure we have boxes */
-	if ( lwgeom2->bbox )
+	if ( FLAGS_GET_GEODETIC(lwgeom2->flags) && lwgeom2->bbox )
 		gbox2 = *(lwgeom2->bbox);
 	else
 		lwgeom_calculate_gbox_geodetic(lwgeom2, &gbox2);
diff --git a/postgis/lwgeom_spheroid.c b/postgis/lwgeom_spheroid.c
index ca50126eb..4496c3da5 100644
--- a/postgis/lwgeom_spheroid.c
+++ b/postgis/lwgeom_spheroid.c
@@ -521,6 +521,8 @@ Datum geometry_distance_spheroid(PG_FUNCTION_ARGS)
 	/* We are going to be calculating geodetic distances */
 	lwgeom_set_geodetic(lwgeom1, LW_TRUE);
 	lwgeom_set_geodetic(lwgeom2, LW_TRUE);
+	lwgeom_refresh_bbox(lwgeom1);
+	lwgeom_refresh_bbox(lwgeom2);
 
 	distance = lwgeom_distance_spheroid(lwgeom1, lwgeom2, sphere, 0.0);
 

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

Summary of changes:
 liblwgeom/lwgeodetic.c    | 4 ++--
 postgis/lwgeom_spheroid.c | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list