[SCM] PostGIS branch stable-3.6 updated. 3.6.4-5-g5027c2502

git at osgeo.org git at osgeo.org
Tue Jun 9 15:51:48 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.6 has been updated
       via  5027c25025a6927058f12d3de2e7bdf04fc10149 (commit)
       via  ebece270c829f552e5eb5a12f972171c51df667b (commit)
      from  923c0638576b8916829233557224fe77a1a1e570 (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 5027c25025a6927058f12d3de2e7bdf04fc10149
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jun 9 15:50:42 2026 -0700

    News entry for #5357

diff --git a/NEWS b/NEWS
index 51a185b62..3e8a53cf0 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ PostGIS 3.6.5
 * Fixes *
 
 - #5989, CurvePolygon distance corner case (Paul Ramsey)
+- #5357, ST_LineFromEncodedPolyline dropping close points (Paul Ramsey)
 
 
 PostGIS 3.6.4

commit ebece270c829f552e5eb5a12f972171c51df667b
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 f76b726f9..6af16b9a2 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 81eae6fae..b7c5cedff 100644
--- a/regress/core/tickets.sql
+++ b/regress/core/tickets.sql
@@ -1598,3 +1598,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 37218c8f9..e100e2806 100644
--- a/regress/core/tickets_expected
+++ b/regress/core/tickets_expected
@@ -489,3 +489,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