busstoptaktik / geodesy

Rust geodesy
Apache License 2.0
63 stars 6 forks source link

Constructing `OpHandle` for EPSG:4326 results in error #79

Closed frewsxcv closed 7 months ago

frewsxcv commented 7 months ago

EPSG:4326 from crs-definitions:

Def { code: 4326, proj4: "+proj=longlat +datum=WGS84 +no_defs", wkt: "GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]" }

The relevant part being the proj4 string: "+proj=longlat +datum=WGS84 +no_defs".

When using parse_proj on that string, this returns "longlat datum=WGS84 no_defs".

Attempting to construct an OpHandle from that via geodesy::Plain::new().op(...).unwrap() results in this error:

Result::unwrap()` on an `Err` value: NotFound("longlat", ": longlat datum=WGS84 no_defs")
frewsxcv commented 7 months ago

Looks like geodesy-wasm implemented this as a no-op:

https://github.com/Rennzie/geodesy-wasm/blob/82f9ef050372d53144969dba60807c7dac38c910/src/geodesy/operators/mod.rs#L10-L14

busstoptaktik commented 7 months ago

Resolved in 220a37f and backported in preparation of 0.11.1

busstoptaktik commented 7 months ago

@Rennzie I think @frewsxcv will also need the unitconvert operator, which I see you have implemented for geodesy-wasm. Is there any chance you will consider a PR here?

Of course, I know I can just, with proper attribution, copy directly from your repo, but that would mean that the commit would be signed by me, rather than directly attributed to you in the log, which feels a bit like academic misconduct.

Rennzie commented 7 months ago

@busstoptaktik yes absolutely! I actually have this on my list to ask if you'd want that. I'll PR it later today. Worth noting that it does NOT implement any time based conversion. Only angular and linear unit conversions.

busstoptaktik commented 7 months ago

@Rennzie Awesome! And I'm sure angular+linear covers the vast majority of use cases, so that's neat. I will hold point release 0.11.1 back until your PR is merged

Rennzie commented 7 months ago

PR here https://github.com/busstoptaktik/geodesy/pull/80

frewsxcv commented 7 months ago

Thank you so much @busstoptaktik and @Rennzie!