[postgis-tickets] r15288 - ST_AsLatLonText: round minutes
Sandro Santilli
strk at kbt.io
Wed Jan 18 12:58:59 PST 2017
Author: strk
Date: 2017-01-18 12:58:59 -0800 (Wed, 18 Jan 2017)
New Revision: 15288
Modified:
trunk/liblwgeom/cunit/cu_print.c
trunk/liblwgeom/lwprint.c
Log:
ST_AsLatLonText: round minutes
Patch by Mike Toews, see #3688
Modified: trunk/liblwgeom/cunit/cu_print.c
===================================================================
--- trunk/liblwgeom/cunit/cu_print.c 2017-01-18 13:18:04 UTC (rev 15287)
+++ trunk/liblwgeom/cunit/cu_print.c 2017-01-18 20:58:59 UTC (rev 15288)
@@ -80,6 +80,8 @@
test_lwprint_assert_format("POINT(-181 -91)", "" , "89\xC2\xB0""0'0.000\"S 1\xC2\xB0""0'0.000\"W");
test_lwprint_assert_format("POINT(-180.0001 -90.0001)", NULL, "89\xC2\xB0""59'59.640\"S 0\xC2\xB0""0'0.360\"W");
test_lwprint_assert_format("POINT(-2348982391.123456 -238749827.34879)", "" , "12\xC2\xB0""39'4.356\"N 31\xC2\xB0""7'24.442\"W");
+ /* See https://trac.osgeo.org/postgis/ticket/3688 */
+ test_lwprint_assert_format("POINT (76.6 -76.6)", NULL, "76\xC2\xB0""36'0.000\"S 76\xC2\xB0""36'0.000\"E");
}
/*
Modified: trunk/liblwgeom/lwprint.c
===================================================================
--- trunk/liblwgeom/lwprint.c 2017-01-18 13:18:04 UTC (rev 15287)
+++ trunk/liblwgeom/lwprint.c 2017-01-18 20:58:59 UTC (rev 15288)
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <string.h>
+#include <math.h>
#include "liblwgeom_internal.h"
/* Ensures the given lat and lon are in the "normal" range:
@@ -313,7 +314,7 @@
if (min_digits > 0)
{
degrees = (long)degrees;
- minutes = (val - degrees) * 60;
+ minutes = fmod(val * 10, 10) * 6;
}
if (sec_digits > 0)
{
More information about the postgis-tickets
mailing list