[Featureserver] Json: unrounding of coordinates

Josh Livni josh at umbrellaconsulting.com
Wed Jan 20 11:59:59 EST 2010


Workaround for simplejson:
http://code.google.com/p/simplejson/issues/detail?id=34 (near the end)
Or, if using py26's json:
http://stackoverflow.com/questions/1447287/format-floats-with-standard-json-module

 -Josh


On Wed, Jan 20, 2010 at 8:43 AM, Peter Robins <fs at peterrobins.co.uk> wrote:

> 2010/1/20 Christopher Schmidt <crschmidt at metacarta.com>:
> >  43.12, or some other number? for example, 43.125 would work, because
> > it is a power-of-two in binary.
>
> yes, it works for 43.125. Ok, so floating-point arithmetic problem,
> but that doesn't explain why it works on some servers but not on
> others.
>
> http://maps.peterrobins.co.uk/cgi-bin/test.cgi is a simple script that
> does:
>
> #!/usr/bin/python
> print "Content-Type: text/plain\n\n"
> import sys
> print "version", sys.version
> import simplejson
> print simplejson.dumps(43.12)
>
> this prints 43.12. On the same server,
> http://maps.peterrobins.co.uk/cgi-bin/fs/details/1 is a real
> linestring where the output is fine. Somewhat older version of python
> (2.4), but otherwise the software is identical.
> _______________________________________________
> Featureserver mailing list
> Featureserver at openlayers.org
> http://featureserver.org/mailman/listinfo/featureserver
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/featureserver/attachments/20100120/055c8054/attachment.html


More information about the Featureserver mailing list