ocean-tracking-network / glatos

9 stars 4 forks source link

Remove `geosphere` from dependencies #235

Closed mhpob closed 3 months ago

mhpob commented 6 months ago

geosphere dependency was removed in favor of geodist in a0209f7, but there are still places where it lingers:

interpolate_path

point_offset

detection_range_handout.Rmd

DESCRIPTION

CC #122 for dependency reduction tracking.

mhpob commented 6 months ago

point_offset uses geosphere::destPoint as its main workhorse. point_offset says that it is calculating the great circle distance (assuming the Earth is a sphere) in its documentation, but it is not --geosphere::destPoint uses a geodesic (assuming the Earth is an ellipse) distance algorithm. There is a difference on the order of a few meters (<5) between these two techniques. @chrisholbrook is this an acceptable change? Great-circle distance is easy to hard code and would be dependency free. Geodesic distance is based on an optimizing function and would probably be best left to the compiled code in geosphere.

The distance in meters between resulting coords from the example using geodesic (current) and great circle (haversine, dependency-free) distance is:

[1] NA 0.3730123 0.5492174 0.6980811 0.8276335 0.9698963 1.1586693 [8] 1.3963796 1.6483109 1.8660119 2.0147364 2.0946781 2.1517980 2.2630914 [15] 2.4829321 2.7918899 3.1107809

Considering that the intent is for this seems to be a coarse gist of where the new point would be (you can only input cardinal directions), it seems that 3 meters difference would be okay.

Update: There can be substantial differences (2km) when we get into >1k km distances along an initial bearing.

mhpob commented 3 months ago

https://github.com/ocean-tracking-network/glatos/pull/236#issuecomment-2294237823

chrisholbrook commented 3 months ago

completed in https://github.com/ocean-tracking-network/glatos/commit/a20ca37eb87c75592db3a5ffecb65b3696ddecc7