georust / geo

Geospatial primitives and algorithms for Rust
https://crates.io/crates/geo
Other
1.49k stars 194 forks source link

Add `ToRadians` and `ToDegrees` traits. #1066

Closed gibbz00 closed 10 months ago

gibbz00 commented 10 months ago

Previous struct methods Point::to_degrees(self) and Point::to_radians(self) are now behind the respective traits.


michaelkirk commented 10 months ago

Since geo-types is an interop crate, we try to keep it pretty svelte, and add functionality in the geo crate when possible. My instinct is that this new trait should live in geo, and we should keep the old (redundant) methods where they were for backwards compatibility, but what do other people think?

gibbz00 commented 10 months ago

My project only uses geo_types, but I'm fine with moving it to geo. Might just become a bit odd that the to_radians/to_degrees methods exists for Point in geo_types but that one would have to pull in geo for the rest.

frewsxcv commented 10 months ago

It's less than ideal since geo is heavier than geo-types, but I'd rather see this get added to geo. Then we could implement ToRadians (and maybe FromRadians?) for any G: CoordsIter.

gibbz00 commented 10 months ago

...I'd rather see this get added to geo. Then we could implement ToRadians ... for any G: CoordsIter.

That's a really good idea! I was unaware of the existence of CoordsIter. Closing this PR in favor of opening a new one with the suggested approach. ✌️