-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Change GeoJSON export precision to follow the GeoJSON spec #43783
Comments
I will start working on a solution and PR for this. |
After investigating older and newer GeoJSON specs and GDAL GeoJSON driver documentation, I think that the default precision of 7 is way to go, since it is used as default precision in the GDAL driver for non-obsolete RFC 7946 spec. |
I created an issue to GDAL as well. |
Unfortunately the GDAL issue was closed without any change. However, I still think that QGIS should default to RFC7946=YES, which would automatically set the COORDINATE_PRECISION to 7. Ideally, this value would show in the dialog, and also allow a user to update that value if desired, overriding the RFC7946 default. Most users today who are exporting to GeoJSON format likely assume that they are exporting to a format based on the current standard (RFC7946) that has been in place since 2016, and not the deprecated specification from 2008. |
I agree with the last message, I don't see any value to have 15 digits for 99. % of users. The option is currently only displayed for GeoJSON exports if I'm not mistaken. The 1 % of users that need more precision would be very well aware that they need to set the precision accordingly (and surely have more of an opinion if they want 8, 9, 15 or even 253 digits). And even for those 1 %, why choose GeoJSON if you need such precision? The majority of people would choose a more space-saving format. For all the others, a precision of 7 digits is way sufficient for the most common use-case of GeoJSON: web displaying. |
Feature description.
Currently when a layer is exported to GeoJSON, QGIS sets the coordinate precision by default to 15, which is a bit too much
The GeoJSON spec recommends 6 decimal precision, which should be enough for 99% of use cases and helps to keep file sizes reasonable. User could then add the decimals if needed, but the default could be definitely lower than 15...
Additional context
What confuses me is that in the QgsJsonExpoer Class seems to have that 6 digits in it already: https://qgis.org/pyqgis/3.4/core/QgsJsonExporter.html
Maybe someone can ecplain the logic behind this?
Discussion about the topic started yesterday on Twitter in this thread.
The text was updated successfully, but these errors were encountered: