JuliaSpace / SatelliteToolbox.jl

A toolbox for satellite analysis written in julia language.
MIT License
248 stars 33 forks source link

Generalize geodetic coordinate conversion by using Geodesy.jl #59

Closed mcontim closed 2 years ago

mcontim commented 2 years ago

Thanks for the great job on the SatelliteToolbox, it is really useful for my work! I was wondering if it has been already considered the possibility of using Geodesy.jl to generalize the ECEF<->LLA coordinates conversion. It would allow to support different Datum and also transformations to local coordinate systems like ENU.

ronisbr commented 2 years ago

Hi @BlueTeo91 !

I am glad that this package is being useful :)

Yes, of course, we can do that. I will analyze how this integration can be done. The only problem would be if the loading time of Geodesy is too high (which I do not think it is).

mcontim commented 2 years ago

Great! Thank you for the answer @ronisbr :) I'm studying Geodesy.jl to use it in my scripts, let me know if I could help for the integration with the SatelliteToolbox

ronisbr commented 2 years ago

Yes, sure! Thanks for the help :)

disberd commented 2 years ago

I had a quick look at the code of SatelliteToolbox and I think we could generalize to any ellipsoid without the need of relying on Geodesy.jl

At the current state, the various geodetic, geocentric, ecef transformation are using formulas that are correct (to my understanding) for any ellipsoid of revolution, but they happen to use the constants for semimajor axis and eccentricity defined for WGS84.

One could add an additional Ellipsoid type that pre-computes the parameters as a function of semi-major axis and flattening and then pass this (maybe as kwargs?) to the various conversion functions with the WGS84 ellipsoid being passed at default.

I suppose this shouldn't impact performance and would open the possibility of specifying any custom ellipsoid with limited changes to the code.

What do you think @ronisbr, is this something you considered at some point or would you be open to something like this?

In case you agree with the idea I might try playing around a bit with code changes to try the Ellipsoid implementation

ronisbr commented 2 years ago

Awesome! Yes, we can define a struct called Ellipsoid for example with the constants. Then we can create some global const and pass them as a keyword arguments. It should be very close to what we do with propagators here: https://github.com/JuliaSpace/SatelliteToolbox.jl/blob/bdb9724ff3571d38f0149d7f4f08236793d3f2a3/src/orbit/propagators/j2.jl#L61

What do you think @ronisbr, is this something you considered at some point or would you be open to something like this?

This kind of functionality in SatelliteToolbox.jl will be very good! It is way simpler than what Geodesy.jl provides, but we will not need to add more dependencies. If an user wants, it is very simple to take a vector from SatelliteToolbox.jl and input to Geodesy.jl.

In case you agree with the idea I might try playing around a bit with code changes to try the Ellipsoid implementation

Thank you very much!