-
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
Better way to serialize to wkt? #55
Comments
Somewhat related: proposal to get rid of items array here: #72 |
I believe this will be closed by #86 |
I would get even better with #88 |
3 tasks
With #89 this becomes: let points = include!("../src/algorithm/test_fixtures/louisiana.rs");
let geo_linestring: geo::LineString<f32> = points.into();
use wkt::ToWkt;
- let wkt: wkt::Wkt<_> = geo::Geometry::from(geo_linestring).to_wkt();
- let wkt_linestring = wkt.items.first().unwrap();
- let serialized = format!("{}", wkt_linestring);
+ let serialized = geo_linestring.wkt_string();
println!("{}", &serialized); edited: Thanks @lnicola |
I guess you mean: - let wkt: wkt::Wkt<_> = geo::Geometry::from(geo_linestring).to_wkt();
- let wkt_linestring = wkt.items.first().unwrap();
- let serialized = format!("{}", wkt_linestring);
+ let serialized = geo_linestring.wkt_string(); |
bors bot
added a commit
that referenced
this issue
Apr 14, 2022
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 <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I was trying to write a geo-type as WKT to file, and this is what I came up with:
Is there already better way?
I was hoping for something like:
Or like
serde_jsons::to_writer
Any thoughts?
The text was updated successfully, but these errors were encountered: