New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add option to allow specifying floating point precision on geojson.dump/geojson.dumps #84
Comments
From what I can tell, there's no way to do this via |
@frewsxcv >>> import json
>>> import math
>>> json.dumps(round(math.pi, 2))
'3.14' In my Fiona project, I'm doing this in Cython: https://github.com/Toblerity/Fiona/blob/master/fiona/_transform.pyx#L151-L180. It could be ported? |
|
No, |
You're right, not sure what I was thinking. sips coffee That looks like a good solution then. |
Has this feature been implemented? I assume not, but checking just in case. Thanks. |
It hasn't been implemented yet, but if someone had time to implement it, I'd gladly review+merge it |
This can be accomplished with the current API via this:
Then use Quick tip: rounding lng-lat to 5 decimal places is pretty close to 1 meter precision. (This varies by latitude, but not a bad estimate.) |
Looking at the Decimal Degrees precision chart, 7 decimal places is the "practical limit of commercial surveying" and 8 is related to "specialized surveying (e.g. tectonic plate mapping)." So, let's go with 8 decimal places as the default; customization can be implemented separately/in parallel. |
I did some more research on the WGS84 Geodetic Datum (the one to which GeoJSON is specifically bound) and it turns out that, according to the U.S. National Geospatial-Intelligence Agency (PDF link) the accuracy of WGS84 is in the 1 meter range. That puts us in the 5-6 decimal place default range. So we'll go with 6 places instead of 8 as the default. |
Just received an email with this request:
The text was updated successfully, but these errors were encountered: