[Featureserver] Json: unrounding of coordinates

Peter Robins fs at peterrobins.co.uk
Wed Jan 20 11:43:22 EST 2010


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.



More information about the Featureserver mailing list