[SCM] PostGIS branch stable-3.4 updated. 3.4.2-33-gbaf331904
git at osgeo.org
git at osgeo.org
Tue Apr 16 17:04:43 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, stable-3.4 has been updated
via baf33190408969656a9abc5d07913ff1db191e4e (commit)
via 2c68d13071458955c04ec2f28439914532bf9912 (commit)
from eb50b64d6c1271e8424b4e9ed338e23d1131e9e2 (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 baf33190408969656a9abc5d07913ff1db191e4e
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Apr 16 17:04:34 2024 -0700
NEWS entry for #5654
diff --git a/NEWS b/NEWS
index ae6a0d4da..87d6d8947 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,8 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.4.1+ is needed.
Fix for PG17 security change (Regina Obe)
- #5695, [address_standardizer_data_us] standardize_address
incorrect handling of directionals (Regina Obe)
+ - #5653, Do not simplify away points when linestring doubles back on
+ itself (Paul Ramsey)
PostGIS 3.4.2
2024/02/08
commit 2c68d13071458955c04ec2f28439914532bf9912
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Apr 16 16:49:40 2024 -0700
Do not remove points when doubling back at zero tolerance, references #5654
diff --git a/liblwgeom/cunit/cu_algorithm.c b/liblwgeom/cunit/cu_algorithm.c
index 44e2187d0..97cf1d8d0 100644
--- a/liblwgeom/cunit/cu_algorithm.c
+++ b/liblwgeom/cunit/cu_algorithm.c
@@ -1813,6 +1813,20 @@ static void test_trim_bits(void)
lwline_free(line);
}
+static void test_ptarray_simplify(void)
+{
+ LWGEOM *geom1 = lwgeom_from_wkt("LINESTRING (2 2,3 2,4 1,3 2, 4 4)", LW_PARSER_CHECK_NONE);
+ LWGEOM *geom2 = lwgeom_from_wkt("LINESTRING (2 2,3 2,4 1,3 2, 4 4)", LW_PARSER_CHECK_NONE);
+ LWLINE *line1 = (LWLINE*)geom1;
+ double tolerance = 0.0;
+ int minpts = 2;
+ ptarray_simplify_in_place(line1->points, tolerance, minpts);
+ ASSERT_LWGEOM_EQUAL(geom1, geom2);
+ lwgeom_free(geom1);
+ lwgeom_free(geom2);
+}
+
+
/*
** Used by test harness to register the tests in this file.
*/
@@ -1820,6 +1834,7 @@ void algorithms_suite_setup(void);
void algorithms_suite_setup(void)
{
CU_pSuite suite = CU_add_suite("algorithm", init_cg_suite, clean_cg_suite);
+ PG_ADD_TEST(suite,test_ptarray_simplify);
PG_ADD_TEST(suite,test_lw_segment_side);
PG_ADD_TEST(suite,test_lw_segment_intersects);
PG_ADD_TEST(suite,test_lwline_crossing_short_lines);
diff --git a/liblwgeom/ptarray.c b/liblwgeom/ptarray.c
index 2581a1f17..c8fede189 100644
--- a/liblwgeom/ptarray.c
+++ b/liblwgeom/ptarray.c
@@ -1689,7 +1689,11 @@ ptarray_simplify_in_place_tolerance0(POINTARRAY *pa)
double dot_ac_ab = ca_x * ba_x + ca_y * ba_y;
double s_numerator = ca_x * ba_y - ca_y * ba_x;
- if (dot_ac_ab < 0.0 || dot_ac_ab > ab_length_sqr || s_numerator != 0)
+ if (p2d_same(kept_pt, next_pt) ||
+ dot_ac_ab < 0.0 ||
+ dot_ac_ab > ab_length_sqr ||
+ s_numerator != 0)
+
{
kept_it++;
kept_pt = curr_pt;
-----------------------------------------------------------------------
Summary of changes:
NEWS | 2 ++
liblwgeom/cunit/cu_algorithm.c | 15 +++++++++++++++
liblwgeom/ptarray.c | 6 +++++-
3 files changed, 22 insertions(+), 1 deletion(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list