[SCM] PostGIS branch stable-3.4 updated. 3.4.6-12-g74a2d3936
git at osgeo.org
git at osgeo.org
Tue Jun 9 15:51:54 PDT 2026
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 74a2d3936b89d4d9afa87d054203446239b2c3de (commit)
via 8016c749937a20b097bc720389dbc0e062505bd6 (commit)
from 972920d9eff7c95fbfa403b077721ccd0f1859e8 (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 74a2d3936b89d4d9afa87d054203446239b2c3de
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jun 9 15:50:45 2026 -0700
News entry for #5357
diff --git a/NEWS b/NEWS
index 6bc77122d..5f9ced28d 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,7 @@ PostGIS 3.4.7
- #5899, pg_upgrade issue for non-standard geography SRID (Paul Ramsey)
- #5916, ST_Split hang with very large ordinates (Paul Ramsey)
- #5989, CurvePolygon distance corner case (Paul Ramsey)
+ - #5357, ST_LineFromEncodedPolyline dropping close points (Paul Ramsey)
PostGIS 3.4.6
commit 8016c749937a20b097bc720389dbc0e062505bd6
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Jun 9 22:38:17 2026 +0000
Fix ST_LineFromEncodedPolyline dropping close points
Use int32_t accumulators instead of double.
Closes #5357
diff --git a/liblwgeom/cunit/cu_in_encoded_polyline.c b/liblwgeom/cunit/cu_in_encoded_polyline.c
index 597493c81..d3d44b408 100644
--- a/liblwgeom/cunit/cu_in_encoded_polyline.c
+++ b/liblwgeom/cunit/cu_in_encoded_polyline.c
@@ -53,6 +53,15 @@ static void in_encoded_polyline_test_precision(void)
"SRID=4326;LINESTRING(-0.250691 49.283048,-0.250633 49.283376,-0.250502 49.283972,-0.251245 49.284028,-0.251938 49.284232,-0.251938 49.2842)");
}
+static void in_encoded_polyline_test_close_points(void)
+{
+ /* #5357: two close points must not collapse to one */
+ do_encoded_polyline_test(
+ "__nphBgcoeiA?@",
+ 6,
+ "SRID=4326;LINESTRING(38.903876 55.336448,38.903875 55.336448)");
+}
+
/*
** Used by test harness to register the tests in this file.
*/
@@ -62,4 +71,5 @@ void in_encoded_polyline_suite_setup(void)
CU_pSuite suite = CU_add_suite("encoded_polyline_input", NULL, NULL);
PG_ADD_TEST(suite, in_encoded_polyline_test_geoms);
PG_ADD_TEST(suite, in_encoded_polyline_test_precision);
+ PG_ADD_TEST(suite, in_encoded_polyline_test_close_points);
}
diff --git a/liblwgeom/lwin_encoded_polyline.c b/liblwgeom/lwin_encoded_polyline.c
index 7212314a6..2bb9f7341 100644
--- a/liblwgeom/lwin_encoded_polyline.c
+++ b/liblwgeom/lwin_encoded_polyline.c
@@ -26,6 +26,7 @@
#include <assert.h>
#include <string.h>
#include <math.h>
+#include <stdint.h>
#include "liblwgeom.h"
#include "../postgis_config.h"
@@ -39,8 +40,8 @@ lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
int idx = 0;
double scale = pow(10,precision);
- float latitude = 0.0f;
- float longitude = 0.0f;
+ int32_t latitude = 0;
+ int32_t longitude = 0;
pa = ptarray_construct_empty(LW_FALSE, LW_FALSE, 1);
@@ -55,7 +56,7 @@ lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
res |= (byte & 0x1F) << shift;
shift += 5;
} while (byte >= 0x20);
- float deltaLat = ((res & 1) ? ~(res >> 1) : (res >> 1));
+ int32_t deltaLat = ((res & 1) ? ~(res >> 1) : (res >> 1));
latitude += deltaLat;
shift = 0;
@@ -65,7 +66,7 @@ lwgeom_from_encoded_polyline(const char *encodedpolyline, int precision)
res |= (byte & 0x1F) << shift;
shift += 5;
} while (byte >= 0x20);
- float deltaLon = ((res & 1) ? ~(res >> 1) : (res >> 1));
+ int32_t deltaLon = ((res & 1) ? ~(res >> 1) : (res >> 1));
longitude += deltaLon;
pt.x = longitude/scale;
diff --git a/regress/core/tickets.sql b/regress/core/tickets.sql
index 4bbf7ddb1..cf0ea56d0 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1577,3 +1577,7 @@ SELECT f_table_schema, f_table_name, f_geometry_column, coord_dimension, srid, t
FROM geometry_columns WHERE f_table_name IN ('test5829', 'test5978')
ORDER BY f_table_name, f_geometry_column;
DROP TABLE IF EXISTS test5829, test5978;
+
+
+-- #5357
+SELECT '#5357', ST_AsText(ST_LineFromEncodedPolyline('__nphBgcoeiA?@', 6), 6);
diff --git a/regress/core/tickets_expected b/regress/core/tickets_expected
index 2effcd0fd..239364576 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -479,3 +479,4 @@ public.test5978.geometry SRID:4326 TYPE:POINT DIMS:2
public|test5829|geom|2|4326|GEOMETRY
public|test5978|geometry|2|4326|POINT
public|test5978|shape|2|4326|POINT
+#5357|LINESTRING(38.903876 55.336448,38.903875 55.336448)
-----------------------------------------------------------------------
Summary of changes:
NEWS | 1 +
liblwgeom/cunit/cu_in_encoded_polyline.c | 10 ++++++++++
liblwgeom/lwin_encoded_polyline.c | 9 +++++----
regress/core/tickets.sql | 4 ++++
regress/core/tickets_expected | 1 +
5 files changed, 21 insertions(+), 4 deletions(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list