-
Notifications
You must be signed in to change notification settings - Fork 24
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
Generic geometry traits for EWKB/PostGIS output and support for Tiny WKB geometries #9
Conversation
Thanks for the postitive feedback! rust-wkt: I wanted to use it for writing tests, but didn't find a way for creating rust-geo geometries from WKT. After looking at the source code again, it seems possible. ToEwkb shouldn't be a problem, since conversion from rust-geo is as easy as TWKB: ST_AsTWKB is included since PostGIS 2.2. See also https://carto.com/blog/smaller-faster/ |
|
I'm currently trying to improve geometry type conversions on the rust-geo side: georust/geo#67 My idea is to implement traits like
This would allow accessing different rust-geo compatible geometry formats without converting data. |
After successful implementation of generic geometry traits, I went back to almost the original EWKB geometry structs. Compared to rust-geo geometry types, they have the following advantages:
I'm currently working on implementing ToSql for the geometry traits, which would allow storing any geometry type implementing these traits (like rust-wkt or hopefully rust-gdal) without conversion. |
904afc0
to
92136d0
Compare
In the meantime I'm quite happy with the implemented types. See also the updated README. One drawback I've just realized is that adding srid to all geometry structs results in more memory consumption for line types, because all line points have an redundant srid field. But I'm hesitating to add additional point types without srid (coordinates?), because of the additional complexity. What do you think, @andelf? |
A new type with srid is OK for occasions where srid check/handling is needed. |
👍 I'll check it out. |
Hi,
Here's a proposal for a rust-postgis refactoring to use rust-geo geometries instead of specific geometry types. The goal is to share geometries with rust-gdal etc. without the need to convert the geometry structs. This pull request covers points and lines so far, but before writing the macros to cover all geometry types I wanted to show the implementation for reviewing. There are some topics to discuss:
Regards,
Pirmin