[SCM] PostGIS branch stable-3.2 updated. 3.2.7-16-gefab0c402
git at osgeo.org
git at osgeo.org
Tue Aug 6 14:59:24 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.2 has been updated
via efab0c402c063bd43a39a3a1b547029cea67e2eb (commit)
via 67fadcd5864847c410e17578ae79f122cb9b1896 (commit)
from 34c0751039ebb275cf8d58ef30c2e7d75ceebb4b (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 efab0c402c063bd43a39a3a1b547029cea67e2eb
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Tue Aug 6 14:56:10 2024 -0700
Entry for #5745
diff --git a/NEWS b/NEWS
index b8f23fa74..9abd1161b 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,8 @@ PostGIS 3.2.8
- #5589, ST_3DDistance error for shared first point (Paul Ramsey)
- #5686, ST_NumInteriorRings and Triangle crash (Paul Ramsey)
- #5765, Handle nearly co-linear edges with slightly less slop (Paul Ramsey)
+ - #5745, St_AsLatLonText rounding errors (Paul Ramsey)
+
PostGIS 3.2.7
2024/02/06
commit 67fadcd5864847c410e17578ae79f122cb9b1896
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 | 2 ++
liblwgeom/cunit/cu_print.c | 5 +++++
liblwgeom/lwprint.c | 8 +++++++-
3 files changed, 14 insertions(+), 1 deletion(-)
hooks/post-receive
--
PostGIS
More information about the postgis-tickets
mailing list