Module geodesy.geodesic_intersection

Find where two route segments meet on an ellipsoid.

Give each segment by its two geographic endpoints. The operation examines the finite shortest paths between the endpoints, not infinitely extended lines. A successful operation returns one geometric result:

- none: the finite segments have no common point; - point: the finite segments share exactly one point; - overlap: the segments share a stretch of the same route.

Coincident segments expose the actual geographic endpoints of the bounded overlap. GeographicLib's internal displacement/mode representation is not leaked through the public API.

The solver uses prepared GeodesicLine values and Karney's iterative local spherical correction. It does not project the problem into an ordinary planar CRS.

Endpoint pairs must define non-degenerate, unambiguous shortest geodesics. Exact antipodes and Karney's oblate equal-and-opposite-latitude multiple-shortest-geodesic case are rejected by the checked operation.

Date

October 7, 2026

Functions

NameDescription
allGeodesicIntersections(intersector, firstLine, secondLine, maxDisplacement, output, workspace) Throwing prepared-state zero-reference all-intersection enumeration.
allGeodesicIntersections(solver, firstLine, secondLine, maxDisplacement, referenceOnFirst, referenceOnSecond, output, workspace) Throwing one-shot all-intersection enumeration.
allGeodesicIntersections(intersector, firstLine, secondLine, maxDisplacement, referenceOnFirst, referenceOnSecond, output, workspace) Throwing prepared-state all-intersection enumeration.
closestGeodesicIntersection(solver, firstLine, secondLine, referenceOnFirst, referenceOnSecond) Throwing prepared-line closest intersection.
closestGeodesicIntersection(intersector, firstLine, secondLine, referenceOnFirst, referenceOnSecond) Throwing prepared-state closest intersection for prepared lines.
closestGeodesicIntersection(intersector, firstStart, firstAzimuth, secondStart, secondAzimuth, referenceOnFirst, referenceOnSecond) Throwing prepared-state closest intersection for line definitions.
closestGeodesicIntersection(solver, firstStart, firstAzimuth, secondStart, secondAzimuth, referenceOnFirst, referenceOnSecond) Throwing origin/azimuth closest intersection.
intersectGeodesicSegments(solver, firstStart, firstEnd, secondStart, secondEnd) Intersect two bounded shortest ellipsoidal geodesic segments.
nextGeodesicIntersection(solver, firstLine, secondLine) Throwing prepared-line next-intersection operation.
nextGeodesicIntersection(intersector, firstLine, secondLine) Throwing prepared-state next-intersection operation for prepared lines.
nextGeodesicIntersection(intersector, knownIntersection, firstAzimuth, secondAzimuth) Throwing prepared-state next-intersection operation for a known crossing.
nextGeodesicIntersection(solver, knownIntersection, firstAzimuth, secondAzimuth) Throwing common-origin/azimuth next-intersection operation.
tryAllGeodesicIntersections(intersector, firstLine, secondLine, maxDisplacement, referenceOnFirst, referenceOnSecond, output, workspace, enumeration) Enumerate all intersections within an L1 displacement radius.
tryAllGeodesicIntersections(solver, firstLine, secondLine, maxDisplacement, referenceOnFirst, referenceOnSecond, output, workspace, enumeration) One-shot all-intersection enumeration using the same mathematical kernel.
tryAllGeodesicIntersections(intersector, firstLine, secondLine, maxDisplacement, output, workspace, enumeration) Zero-reference overload using prepared state.
tryAllGeodesicIntersections(solver, firstLine, secondLine, maxDisplacement, output, workspace, enumeration) Zero-reference one-shot overload.
tryClosestGeodesicIntersection(solver, firstLine, secondLine, referenceOnFirst, referenceOnSecond, result) Find the closest intersection of two prepared oriented geodesics.
tryClosestGeodesicIntersection(intersector, firstLine, secondLine, referenceOnFirst, referenceOnSecond, result) Find the closest intersection using reusable intersection-family state.
tryClosestGeodesicIntersection(solver, firstLine, secondLine, result) Zero-reference prepared-line overload.
tryClosestGeodesicIntersection(intersector, firstLine, secondLine, result) Zero-reference overload using reusable intersection-family state.
tryClosestGeodesicIntersection(solver, firstStart, firstAzimuth, secondStart, secondAzimuth, referenceOnFirst, referenceOnSecond, result) Construct lines from origins and azimuths and find the closest intersection.
tryClosestGeodesicIntersection(intersector, firstStart, firstAzimuth, secondStart, secondAzimuth, referenceOnFirst, referenceOnSecond, result) Construct lines and find the closest intersection using reusable family state.
tryClosestGeodesicIntersection(solver, firstStart, firstAzimuth, secondStart, secondAzimuth, result) Zero-reference origin/azimuth overload.
tryClosestGeodesicIntersection(intersector, firstStart, firstAzimuth, secondStart, secondAzimuth, result) Zero-reference origin/azimuth overload using reusable family state.
tryIntersectGeodesicSegments(solver, firstStart, firstEnd, secondStart, secondEnd, result) Find whether two finite geographic route segments cross or overlap.
tryNextGeodesicIntersection(solver, firstLine, secondLine, result) Find the next closest intersection after a known common-origin crossing.
tryNextGeodesicIntersection(intersector, firstLine, secondLine, result) Find the next intersection using ellipsoid-dependent prepared state.
tryNextGeodesicIntersection(solver, knownIntersection, firstAzimuth, secondAzimuth, result) Construct two common-origin oriented geodesics and find their next crossing.
tryNextGeodesicIntersection(intersector, knownIntersection, firstAzimuth, secondAzimuth, result) Construct common-origin lines and find the next crossing using reusable family state.

Structs

NameDescription
GeodesicClosestIntersectionResult Result of the globally closest intersection of two oriented geodesics.
GeodesicIntersectionEnumeration Metadata produced by an all-intersection enumeration.
GeodesicIntersectionPoint One enumerated intersection of two oriented geodesics.
GeodesicIntersectionSolver Prepared ellipsoid-dependent state for repeated geodesic intersections.
GeodesicIntersectionWorkspace Caller-owned reusable scratch storage for all-intersection enumeration.
GeodesicIntersectionWorkspaceEntry Opaque caller-owned scratch entry for all-intersection enumeration.
GeodesicNextIntersectionResult Result of the next intersection after a known common-origin crossing.
GeodesicSegmentIntersectionResult Result of intersecting two bounded shortest ellipsoidal geodesic segments.

Enums

NameDescription
GeodesicIntersectionCoincidence Relationship of coincident oriented geodesics.
GeodesicIntersectionEnumerationStatus Checked enumeration status for all-intersection queries.
GeodesicSegmentIntersectionKind Geometric result kind for two bounded geodesic segments.