[Featureserver] Json: unrounding of coordinates
Christopher Schmidt
crschmidt at metacarta.com
Wed Jan 20 08:48:06 EST 2010
On Wed, Jan 20, 2010 at 11:01:57AM +0000, Peter Robins wrote:
> This is a bit OT as it seems to be a problem with simplejson and not
> FS, but I'm having trouble tracking down why it's happening. On
> GeoJson output, coordinates are being 'unrounded', such as 43.12 being
> output as 43.119999999999997. This is adding hugely to the size of the
> output. If I go into python and do:
> >>> import simplejson
> >>> simplejson.dumps(43.12)
> I get 43.119999999999997, which makes it look like a simplejson issue.
> However, it doesn't occur on every server; on some, it outputs 43.12,
> even though this is the same version of simplejson.
43.12, or some other number? for example, 43.125 would work, because
it is a power-of-two in binary.
There is no way that I know of to control this. Welcome to floating point
numbers :)
-- Chris
> This makes me
> think it might be some issue with some control file being defined
> differently or something.
>
> Can anyone out there tell me what is causing this, and what I can do
> to prevent it?
> _______________________________________________
> Featureserver mailing list
> Featureserver at openlayers.org
> http://featureserver.org/mailman/listinfo/featureserver
--
Christopher Schmidt
MetaCarta
More information about the Featureserver
mailing list