The package has also a set of spherical geodesy tools, also ported from the
library developed in JavaScript by Chris Veness (see
Movable Type Scripts
web site and source
code
on GitHub).
These geodesy functions are based on calculations on a spherical earth model.
Distance, bearing, destination and other functions are provided both for great
circle paths and rhumb lines. All calculations use simple spherical
trigonometric algorithms.
Actually the earth is slightly ellipsoidal, not spherical. However errors are
typically up to 0.3% (see notes by
Movable Type Scripts)
when using a spherical model instead of an ellipsoidal.
🔢 Ellipsoidal vs spherical geodesy
You can try both and choose!
Ellipsoidal geodesy functions are more
accurate, but spherical geodesy functions are a bit faster as the
implementation is much simpler.
🧐 Great circle vs rhumb line
As already mentioned for spherical geodesy the package provides two methods,
calculations along great circle paths and rhumb lines.
According to Wikipedia, a
great circle or
orthodrome is the circular intersection of a sphere and a plane passing
through the sphere’s center point. A
rhumb line or
loxodrome is an arc crossing all meridians of longitude at the same angle,
that is, a path with constant bearing as measured relative to true north.
Differences between a rhumb line (blue) compared to a great-circle arc (red) as
described by Wikipedia are
visualized in the illustration (top: orthographic projection, bottom: Mercator
projection) showing paths from Lisbon, Portugal to Havana, Cuba.
The rhumb line path is slightly longer than the path along the great circle.
Rhumb lines are sometimes used in marine navigation as it’s easier to follow a
constant compass bearing than adjusting bearings when following a great circle
path.
🌐 Great circle paths
Examples using great circle paths (orthodromic) on a spherical earth model:
🗺️ Rhumb line paths
Examples using rhumb line paths (loxodromic) on a spherical earth model:
More examples are provided in the API documentation and
test cases.