georust / geozero

Zero-Copy reading and writing of geospatial data.
Apache License 2.0
321 stars 30 forks source link

Pass formatter parameters to WKT writer #200

Open kylebarron opened 4 months ago

kylebarron commented 4 months ago

This is just a prototype of #199.

Based on the example here, this optionally passes down a precision parameter to the format!() call.

One thing I noticed when I hard-coded format!("{x:.3} {y:.3}") is that setting that forces even integers to have 3 decimal points. E.g.

---- geojson::geojson_reader::test::conversions stdout ----
thread 'geojson::geojson_reader::test::conversions' panicked at geozero/src/geojson/geojson_reader.rs:419:9:
assertion `left == right` failed
  left: "POINT(10.000 20.000)"
 right: "POINT(10 20)"

Potentially this means what I actually want to do to solve my goal in #199 is to truncate the precision of my data, and that will automatically get printed as I want...