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:

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

NEWTON_TOL_RAD

Convergence tolerance of the Newton step in inverse_meridian_arc().

NEWTON_MAX_ITER

Iteration cap of the Newton inversion.

QUADRATURE_TOL_M

Absolute tolerance of meridian_arc_quadrature(), in metres.

QUADRATURE_MAX_INTERVALS

Interval cap of the adaptive refinement.

VINCENTY_TOL_RAD

Convergence tolerance of the Vincenty iterations.

VINCENTY_MAX_ITER

Iteration cap of the Vincenty iterations.

Functions

direct_geodesic

Return the end point of a geodesic given start, azimuth and length.

geodetic_to_sinusoidal

Project a geodetic position onto the parallels plane.

inverse_geodesic

Return the geodesic distance and initial azimuth between two points.

inverse_meridian_arc

Return the latitude whose meridian arc from the equator is arc_m.

meridian_arc

Return the meridian arc length from the equator to a latitude.

meridian_arc_quadrature

Return the meridian arc by composite Simpson quadrature of Eq.

meridian_radius

Return the meridional radius of curvature M at a latitude.

prime_vertical_radius

Return the prime-vertical radius of curvature N at a latitude.

sinusoidal_to_geodetic

Invert the parallels-plane projection back to geodetic coordinates.