-
Notifications
You must be signed in to change notification settings - Fork 25
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
WIP: Impl/from geo types #88
Conversation
it also addresses #55 |
I'm curious what you though of my proposal in #89 @categulario |
With |
This requires Display to be implemented (see georust#86) but it shows something that otherwise is quite hard to learn how to do.
04d56ff
to
3a76064
Compare
Just pushed some commits and rebased main. ToWkt is restored but deprecated. The doc tests are fixed. |
Closing this since it no longer reflects my ideas, mostly laid out in #73 |
89: Easier serialization of wkt with ToWkt::wkt_string/write_wkt r=urschrei a=michaelkirk - [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md). - [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users. - [x] I ran cargo fmt --- Fixes #55 - adds an easier API to serialize a geo-type. ~~Depends on #86, so merge that first.~~ Merged! ~~partially conflicts with #88, because I'm relying on the `ToWkt` trait.~~ superseded! Co-authored-by: Michael Kirk <michael.code@endoftheworl.de>
CHANGES.md
if knowledge of this change could be valuable to users.addresses #73 and #48.
This adds impls of From for every type and the Geometry enum in
geo_types
. It makes it unnecessary to bring to scope the ToWkt trait which gets deleted because it was not being used actually. Of course this is a breaking change.Additionally I added some docs on the most relevant cases for this crate: parsing a wkt and getting a geometry and having a geometry and getting its WKT string. This is what actually motivates most of the PRs I've been doing, I just wanted to do that .-.
Some opinions
What if Wkt was instead a trait itself, implemented for every type in
geo_types
that provided a single method:wkt(&self) -> String
?being
georust
an environment for building geo applications it makes sense that things are integrated to work well within the environment, and maybe providing someLineString
etc. traits which, if implemented on foreign types would give automatically aWkt
impl that allows to get its WKT string. And perhaps aWktGeometry
enum with inner types refering to those in thegeo_types
crate just for the purposes of having something to parse a string into. Although it probably makes more sense to just haveFromStr
impls for thegeo_types
themselves...Just an idea, I think it would simplify a lot how work with this crate happens.
This actually requires #86 for the docs to pass the tests