Skip to content
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

Deprecate Coordinate, rename to Coord #540

Closed
frewsxcv opened this issue Nov 15, 2020 · 4 comments · Fixed by #924
Closed

Deprecate Coordinate, rename to Coord #540

frewsxcv opened this issue Nov 15, 2020 · 4 comments · Fixed by #924

Comments

@frewsxcv
Copy link
Member

I've been thinking about this for years...

@frewsxcv frewsxcv added the idea label Nov 15, 2020
@michaelkirk
Copy link
Member

michaelkirk commented Nov 15, 2020

It didn't occur to me that you could even do this.

I guess it's something like:

pub struct Coord<T>
where
    T: CoordinateType,
{
    pub x: T,
    pub y: T,
}

#[deprecated(note = "use Coord<T> instead")]
pub type Coordinate<T> = Coord<T>;

It is a very long word that I type a lot...

@frewsxcv
Copy link
Member Author

It is a very long word that I type a lot...

For whatever reason, I consistently accidentally type Coordiante and as soon as I realize it I pronounce the typo with an Italian accent with a long 'a' and it's now a meme in my head and I want it to stop 🤪

@busstoptaktik
Copy link

Just a remark about clashing names: In Rust Geodesy, Coord is the fundamental 4-dimensional geodetic coordinate type,

https://github.com/busstoptaktik/geodesy/blob/25253fedf057e04ed710fb6b3e4d35fc8050ed34/src/coord/mod.rs#L9

This Coord is a newtype around a [f64; 4], since geodetic operations are essentially 4-dimensional: All transformations between modern CRS's involve 14-parameter Helmert transformations - 3D, but with time dependent coefficients.

Type name clashes aside, I would like to increase the interoperability between Rust Geodesy and GeoRust, and have considered (but not had time to prototype, so this is purely hot air) something like a common trait, including methods to turn a GeoRust Coordinate (or whatever implements the trait) into a [f64; 4] (essentially by setting 3rd and 4th dimension to f64:NAN, or whatever the implementer of the trait finds reasonable), and to build a GeoRust Coordinate from a [f64; 4] (by ignoring 3rd and 4th dimension).

This would make Rust Geodesy depend on the GeoRust Coordinate type (and/or rather, the related trait), without forcing GeoRust to know anything about Rust Geodesy, since the interface can be through a commonly implemented trait, and the ordinary Rust type [f64; 4].

Take this as "just a comment" - I do not think the clash of names will really be a practical problem: The 2D nature of GeoRust makes it extremely useful as long as you either live your life inside a single reference frame, or don't care about sub-meter accuracy, and GeoRust does not really need Rust Geodesy.

On the other hand, the GeoRust interface to PROJ is rather complex, while, due to the 2D foundation, not really getting meaningful access to all of PROJ's geodetic goodness. So perhaps it is also time to consider a step backwards in time and implement a 2D Rust cartographic projection library? (I'm not volunteering - I'm a geodesist, not a cartographer :-) ) The few projections currently implemented as "proof of concept" in Rust Geodesy definitely cannot cover the needs of GeoRust.

@busstoptaktik
Copy link

(replying to myself here: The "common trait" I'm referring to is probably something like GeoRust/GeoZero)

@bors bors bot closed this as completed in 3b0d573 Nov 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants