itacart.geodesy
Ellipsoidal geodesy: the parallels-plane projection and WGS84 geodesics.
Cartographic foundation of ITACaRT, from Silva, Dietzsch & Shiguemori (2025), section 2.3, equations (1) and (2):
x = f1(lambda, phi) = lambda * a cos(phi) / sqrt(1 - e^2 sin^2 phi) (1)
y = f2(phi) = int_0^phi a(1 - e^2) / (1 - e^2 sin^2 P)^{3/2} dP (2)
Provenance: itacart_core/geodesy.py, from the itacart-app work. Ported
rather than rewritten.
Read structurally, the two equations say something simple. The factor in
Eq. (1) is N(phi) cos phi, the radius of the parallel circle, so x
is true distance along the parallel. The integrand of Eq. (2) is
M(phi), the meridional radius of curvature, so y is true distance
along the meridian. The projection is therefore equidistant on both axes
from the origin and equivalent by construction – which is what carries
the equal-area property of ITACaRT.
Two consequences shape this module:
meridian_arc()is theycomponent ofgeodetic_to_sinusoidal(). The integral is implemented once.The derivative of
meridian_arc()is its own integrand,meridian_radius(), in closed form. That is what makes the Newton inversion ininverse_meridian_arc()cheap and unconditionally convergent –M(phi) > 0everywhere, so the arc is strictly monotonic and has no saddle.
Units. Every public function takes and returns degrees for angles and
metres for lengths. There is no degree/radian boundary inside the public
surface: the radian domain lives in the _rad-suffixed private helpers
and nowhere else. A unit error at this layer raises nothing –
it produces a plausible wrong answer – so the rule is uniform rather than
convenient.
Argument order. The core is (lon, lat), cartesian (x, y) order,
throughout, geodesics included. The H3-compatible aliases take
(lat, lng) and live in the package facade, not here.
Porting warning. itacart_core uses the opposite order:
geodesy.forward(lat, lon) and geodesy.inverse(x, y) -> (lat, lon),
and cells.point_to_cell(lat, lon, resolution) on top of it. Whoever
ports cells.py has to swap both the call and the unpacking. A
swap raises nothing – it lands on a valid coordinate somewhere else on
the globe – so it is pinned by test_argument_order_is_lon_lat_not_lat_lon
rather than left to a comment.
No PROJ anywhere: both equations are implemented directly, and the geodesic solutions are held to a Runge-Kutta integration of the geodesic equations and to Clairaut’s relation rather than to a second library.
Module constants
Convergence tolerance of the Newton step in |
|
Iteration cap of the Newton inversion. |
|
Absolute tolerance of |
|
Interval cap of the adaptive refinement. |
|
Convergence tolerance of the Vincenty iterations. |
|
Iteration cap of the Vincenty iterations. |
Functions
Return the end point of a geodesic given start, azimuth and length. |
|
Project a geodetic position onto the parallels plane. |
|
Return the geodesic distance and initial azimuth between two points. |
|
Return the latitude whose meridian arc from the equator is |
|
Return the meridian arc length from the equator to a latitude. |
|
Return the meridian arc by composite Simpson quadrature of Eq. |
|
Return the meridional radius of curvature |
|
Return the prime-vertical radius of curvature |
|
Invert the parallels-plane projection back to geodetic coordinates. |