-
Notifications
You must be signed in to change notification settings - Fork 45
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
Serializer ignores the IPrecisionModel of geometries #27
Comments
try with |
That doesn't seem to work. After a quick look at the source code, the serializer seems to only use the factory when reading GeoJSON into geometries, not when writing geometries into GeoJSON. It could also be possible that someone wants to serialize a |
actually this makes sense to me. precision model obviously can't be stored as a defined property inside geojson because of specs violation (but you can maybe add a custom attribute in each feature) and in json geometry looks correct to store info with the maximum precision viable. so, this is a correct behavior to me. |
I'm not sure you understood the issue completely. I'm not saying that the precision model itself should be included in the output GeoJSON. I'm saying that the serializer should probably format the coordinates according to the geometry's defined precision model. In my example, the geometry was created with a one decimal point precision model, and thus the WKT of the geometry was However, the serializer doesn't respect the precision, and outputs the coordinates too precisely: What I would expect is that the serializer respects the precision and outputs this: The reason why I noticed this issue is that I'm creating 2D polygons with a lot of coordinates, and applying transformations to them. The transformation causes the coordinates to be very precise and it also adds the Z component, e.g. If the serializer respected the precision model, I could create a custom For now I just created a workaround that manually goes through each geometry and formats the coordinates before serialization. It works, but it's not very elegant. |
According to the GeoJSON spec your coordinates are out of bounds. You can use To handle that on the
Additionally we can add an |
When serializing a geometry, the serializer seems to ignore the
IPrecisionModel
of theIGeometry
. The coordinates in the JSON are not formatted according to the precision model, but are outputted as is.Example:
Version: 1.15.2
The text was updated successfully, but these errors were encountered: