Closed michaelkirk closed 2 years ago
Somewhat related: proposal to get rid of items array here: #72
I believe this will be closed by https://github.com/georust/wkt/pull/86
I would get even better with #88
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();
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?