geo
geo copied to clipboard
Write custom, more succinct, debug output for all geometries in geo-types
Currently we're just using the derived Debug, which is pretty noisy. Especially for our compound structures, having a denser representation can make debugging easier.
e.g.
Coordinate
This one's maybe fine as is?
let coord = Coordinate {x: 1.0, y: 2.0};
println!("coord: {:?}", &coord);
> coord: Coordinate { x: 1.0, y: 2.0 }
Point
But elsewhere, "Coordinate" isn't adding anything in my opinion:
let point = Point::from(coord);
println!("point: {:?}", &point);
> point: Point(Coordinate { x: 1.0, y: 2.0 })
Maybe something like: Point( x: 1.0, y: 2.0)
would be better?
Line
let line = Line::new(coord, coord);
println!("line: {:?}", &line);
> line: Line { start: Coordinate { x: 1.0, y: 2.0 }, end: Coordinate { x: 3.0, y: 4.0 } }
Maybe something like: Line[(x: 1.0, y: 2.0) -> (x: 3.0, y: 4.0)]
would be better?
MultiPoint
let multi_point = MultiPoint(vec![point, point, point]);
println!("multi_point: {:?}", &multi_point);
> multi_point: MultiPoint([Point(Coordinate { x: 1.0, y: 2.0 }), Point(Coordinate { x: 3.0, y: 4.0 }), Point(Coordinate { x: 5.0, y: 6.0 })])
Maybe something like: MultiPoint[(x: 1.0, y: 2.0), (x: 3.0, y: 4.0), (x: 5.0, y: 6.0)]
would be better?
etc
This isn't intended to be a comprehensive spec - just trying to exemplify what I think is valuable - putting some thought into the specifics for each type will be some work.
lol am I just re-inventing WKT?
This all sounds good to me! 👍🏻