[SCM] PostGIS branch stable-3.4 updated. 3.4.2-53-g0884a4f6d

git at osgeo.org git at osgeo.org
Tue Aug 6 14:54:56 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  0884a4f6d5864a180bc7ea40fe2859a4f306241a (commit)
       via  04fdaeeab55e6befd1efab6ec1bb797268acde5f (commit)
      from  07b12098db027acfd36b2cb2d17aa4a230b97e8a (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 0884a4f6d5864a180bc7ea40fe2859a4f306241a
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Aug 6 14:54:51 2024 -0700

    Entry for #5745

diff --git a/NEWS b/NEWS
index 55dd37412..801b0db90 100644
--- a/NEWS
+++ b/NEWS
@@ -34,6 +34,7 @@ To take advantage of all SFCGAL featurs, SFCGAL 1.4.1+ is needed.
  - #5752, ST_ClosestPoint(geography) error (Paul Ramsey)
  - #5740, ST_DistanceSpheroid(geometry) incorrectly handles polygons (Paul Ramsey)
  - #5765, Handle nearly co-linear edges with slightly less slop (Paul Ramsey)
+ - #5745, St_AsLatLonText rounding errors (Paul Ramsey)
 
 PostGIS 3.4.2
 2024/02/08

commit 04fdaeeab55e6befd1efab6ec1bb797268acde5f
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Aug 6 14:41:36 2024 -0700

    Fix St_AsLatLonText Rounding Errors, references #5745

diff --git a/liblwgeom/cunit/cu_print.c b/liblwgeom/cunit/cu_print.c
index 7274b6109..2f6c52284 100644
--- a/liblwgeom/cunit/cu_print.c
+++ b/liblwgeom/cunit/cu_print.c
@@ -204,6 +204,11 @@ test_lwpoint_to_latlon_format_orders(void)
 static void
 test_lwpoint_to_latlon_optional_format(void)
 {
+	test_lwpoint_to_latlon_assert_format("POINT(21.9999999 1)",
+		"D-M-S-C", "1-0-0-N 22-0-0-E");
+	test_lwpoint_to_latlon_assert_format("POINT(21.99999999999 1)",
+		"D-M-S-C", "1-0-0-N 22-0-0-E");
+
 	test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD", "-12.346 -45.455");
 	test_lwpoint_to_latlon_assert_format("POINT(-45.4545 -12.34567)", "DD.DDD C", "12.346 S 45.455 W");
 	test_lwpoint_to_latlon_assert_format(
diff --git a/liblwgeom/lwprint.c b/liblwgeom/lwprint.c
index 68bb51b2e..c8c58265c 100644
--- a/liblwgeom/lwprint.c
+++ b/liblwgeom/lwprint.c
@@ -332,10 +332,16 @@ static char * lwdouble_to_dms(double val, const char *pos_dir_symbol, const char
 		{
 			/* See if the formatted seconds round up to 60. If so, increment minutes and reset seconds. */
 			round_pow = pow(10, sec_dec_digits);
-			if (floorf(seconds * round_pow) / round_pow >= 60)
+			if (lround(seconds * round_pow) >= 60 * round_pow)
 			{
 				minutes += 1;
 				seconds = 0;
+				/* See if the formatted minutes round up to 60. If so, increment degrees and reset seconds. */
+				if (lround(minutes * round_pow) >= 60 * round_pow)
+				{
+					degrees += 1;
+					minutes = 0;
+				}
 			}
 		}
 	}

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

Summary of changes:
 NEWS                       | 1 +
 liblwgeom/cunit/cu_print.c | 5 +++++
 liblwgeom/lwprint.c        | 8 +++++++-
 3 files changed, 13 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
PostGIS


More information about the postgis-tickets mailing list