-
Notifications
You must be signed in to change notification settings - Fork 16
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
support geojson (de-)serialization #17
Conversation
61588b9
to
26d89f1
Compare
Thank you for pull request. I will be able to analyze it not earlier than the beginning of July. My first thought to implement JSON serialization was to do GeoJSON support, but it required a lot of code, GeoJSON has some limitation and I decided to do custom serialization, because in my practice you ether work with custom data structure by some reason or with something like tiles. But more capabilities usually better than less :) |
If understand correctly the GeoJSON is applicable only in case the coordinate system is WGS 84 https://datatracker.ietf.org/doc/html/rfc7946#section-4, https://epsg.io/4326. I think that it is better to add that restriction for serialization and create geometry objects with srid=4326 in deserialization process. Can you add this change? |
The current implementation already works only with |
Yes, I want to add SRID check. I see two options:
And do the same in deserialization process, so that objects will have correct SRID, because GeoJSON explicitly defines it. |
Yes, adding transformations to the library sounds like a bad idea. I already added it to the deserialization, but to avoid another review-round: how do you want to handle SIRD = None? I'd again say to ignore it and still serialize, so only when there is an explicit different SIRD it'll return an error. |
Looks like none can be treated as 4326 https://postgis.net/docs/using_postgis_dbmanagement.html, and should lead to a serialization without errors.
I think it should work fine:
|
That makes sense and explains why I never had to bother about the srid :) Pushed a new version, also containing two tests for the newly defined behaivour. |
See issue #16
Open points:
GeometryContainer
. Would it be possible to make this more compact?