[postgis-devel] [PostGIS] #2051: ST_AsGeoJSON printing too many digits
PostGIS
trac at osgeo.org
Wed Oct 17 02:14:10 PDT 2012
#2051: ST_AsGeoJSON printing too many digits
---------------------+------------------------------------------------------
Reporter: strk | Owner: pramsey
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.2
Component: postgis | Version: 2.0.x
Keywords: |
---------------------+------------------------------------------------------
Comment(by strk):
Ok I found the real difference.
It's not the precision, but the format string being %.*f for geojson and
%.*g for ST_AsText.
The code in liblwgeom/lwout_geojson.c suggest it was intentional, but I
can't understand the rationale for it. Oliver, can you shed a light here ?
The code is:
{{{
if (fabs(pt.x) < OUT_MAX_DOUBLE)
sprintf(x, "%.*f", precision, pt.x);
else
sprintf(x, "%g", pt.x);
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/2051#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.
More information about the postgis-devel
mailing list