[SCM] PostGIS branch stable-3.3 updated. 3.3.6-34-g0b16547f2
git at osgeo.org
git at osgeo.org
Tue Aug 6 14:59:26 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.3 has been updated
via 0b16547f229211a1816aefe7c318a3d6045d3897 (commit)
via 21b09b010b08eb6672d1e1e9c66479a596662734 (commit)
from 70a47eee6fd6baa5d366e8f7afa34b30aeaefd17 (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 0b16547f229211a1816aefe7c318a3d6045d3897
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Aug 6 14:55:33 2024 -0700
Entry for #5745
diff --git a/NEWS b/NEWS
index 2555b237c..175262553 100644
--- a/NEWS
+++ b/NEWS
@@ -26,6 +26,7 @@ and PostgreSQL 15+.
to not rely on search_path
- #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.3.6
commit 21b09b010b08eb6672d1e1e9c66479a596662734
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