[SCM] PostGIS branch stable-3.4 updated. 3.4.4-49-g521e11092
git at osgeo.org
git at osgeo.org
Tue Sep 9 08:47:19 PDT 2025
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.4 has been updated
via 521e11092c3217158d2298364cd269bec881cba5 (commit)
via 97c85262dc3e876702cfe81de8a98917efa4361e (commit)
from c95f296c192419ce8e1a806054bd97a0ebd7fcf2 (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 521e11092c3217158d2298364cd269bec881cba5
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Sep 9 08:47:13 2025 -0700
News item for #5802
diff --git a/NEWS b/NEWS
index 950ba4f4b..bca0da822 100644
--- a/NEWS
+++ b/NEWS
@@ -29,6 +29,7 @@ Proj 6.1+ required.
- #5909, ST_ValueCount crashes on empty table (Paul Ramsey)
- #5917, ST_Relate becomes unresponsive (Paul Ramsey)
- Support build under Pg19 (Paul Ramsey)
+ - #5082, LRS proportions clamped to [0,1] (Pawel Ostrowski)
PostGIS 3.4.4
commit 97c85262dc3e876702cfe81de8a98917efa4361e
Author: postrowski <pawel.ostrowski at softelnet.pl>
Date: Tue Sep 9 08:43:24 2025 -0700
clamp [0,1] when float arithmetic is used in locate_point functions (!265)
Fix ticket #5082
There are functions that promise to return values from range [0, 1], but due to floating point arithmetic, the return value sometimes may jump outside that range.
This is problematic in SQL when many functions are composed and the return value exceed 1.
Adding simple `if` conditions solves the problem.
Reviewed-on: https://gitea.osgeo.org/postgis/postgis/pulls/265
Reviewed-by: Laurențiu Nicola <lnicola at dend.ro>
Co-authored-by: postrowski <pawel.ostrowski at softelnet.pl>
Co-committed-by: postrowski <pawel.ostrowski at softelnet.pl>
diff --git a/liblwgeom/lwgeodetic_measures.c b/liblwgeom/lwgeodetic_measures.c
index 8c2bca596..27f57ecdb 100644
--- a/liblwgeom/lwgeodetic_measures.c
+++ b/liblwgeom/lwgeodetic_measures.c
@@ -548,7 +548,14 @@ ptarray_locate_point_spheroid(
if ( (seg >= (pa->npoints-2)) && p2d_same(&proj, p) )
return 1.0;
- return partlength / totlength;
+ /* Floating point arithmetic is not reliable, make sure we return values [0,1] */
+ double result = partlength / totlength;
+ if ( result < 0.0 ) {
+ result = 0.0;
+ } else if ( result > 1.0 ) {
+ result = 1.0;
+ }
+ return result;
}
/*****************************************************************************/
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 3eaf417b2..91984e860 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -1490,7 +1490,14 @@ ptarray_locate_point(const POINTARRAY *pa, const POINT4D *p4d, double *mindistou
LWDEBUGF(3, "plen %g, tlen %g", plen, tlen);
- return plen/tlen;
+ /* Floating point arithmetic is not reliable, make sure we return values [0,1] */
+ double result = plen / tlen;
+ if ( result < 0.0 ) {
+ result = 0.0;
+ } else if ( result > 1.0 ) {
+ result = 1.0;
+ }
+ return result;
}
/**
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 6e665a940..4bbf7ddb1 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1551,6 +1551,14 @@ SELECT '#5876', ST_AsText(ST_AddPoint(
'LINESTRING (1 1, 2 2)'::geometry,
'POINT EMPTY'::geometry), 2);
+
+-- https://trac.osgeo.org/postgis/ticket/5082 st_linelocatepoint returns value over 1
+select '#5082', ST_LineLocatePoint(
+ 'LINESTRING (614506.766313283 390577.5124384557, 614494.089082674 390574.5586551775, 614494.8569439995 390562.1301508558, 614493.5246928157 390549.7664042029, 614486.5713433414 390544.32637928444, 614487.6296766759 390492.9548792321, 614487.6296766759 390492.9548792321)'::geometry,
+ 'POINT (614487.6296766759 390492.9548792321)'::geometry
+ ) <= 1.0;
+
+
-- -------------------------------------------------------------------------------------
-- #5978, geometry_columns not showing right SRID and Type
-- #5829, SELECT geometry_columns returns unexpected error
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index dc8a7cf95..2effcd0fd 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -473,6 +473,7 @@ ERROR: Geometry contains invalid coordinates
#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
#5647|intersects_empty false|within_empty false|contains_empty false|coveredby_empty false|covers_empty false|intersects_mixed_empty true|within_mixed_empty false|contains_mixed_empty false|coveredby_mixed_empty true|covers_mixed_empty true
#5876|LINESTRING(1 1,2 2)
+#5082|t
public.test5978.shape SRID:4326 TYPE:POINT DIMS:2
public.test5978.geometry SRID:4326 TYPE:POINT DIMS:2
public|test5829|geom|2|4326|GEOMETRY
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/lwgeodetic_measures.c | 9 ++++++++-
liblwgeom/ptarray.c | 9 ++++++++-
regress/core/tickets.sql | 8 ++++++++
regress/core/tickets_expected | 1 +
5 files changed, 26 insertions(+), 2 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list