Great-circle distance between two points, in KILOMETRES.
⚠️ This is the only distance function in the repo that does NOT return metres —
utils/geo/haversine.haversineDistance() and the filter helpers all return metres.
The two families share the same scalar signature (lat1, lng1, lat2, lng2) => number,
so TypeScript cannot tell them apart: substituting one for the other type-checks
cleanly and shifts every comparison by a factor of 1000. That is exactly what happened
in route-filter until KERNEL S11. Convert explicitly at the call site.
⚠️ This line pointed at a plugin file as the example to imitate, until the 19/08/2026 —
a file that no longer exists, and whose successor does NOT do the conversion. Measured
the same day: no caller in this repo converts any more, so there is nothing left to
imitate. That is worth knowing rather than hiding: the trap is guarded by this comment
alone, not by an example a reader could copy.
Kept in kilometres because it is published as GeoLeaf.Utils.getDistance.
Great-circle distance between two points, in KILOMETRES.
⚠️ This is the only distance function in the repo that does NOT return metres —
utils/geo/haversine.haversineDistance()and the filter helpers all return metres. The two families share the same scalar signature(lat1, lng1, lat2, lng2) => number, so TypeScript cannot tell them apart: substituting one for the other type-checks cleanly and shifts every comparison by a factor of 1000. That is exactly what happened inroute-filteruntil KERNEL S11. Convert explicitly at the call site.⚠️ This line pointed at a plugin file as the example to imitate, until the 19/08/2026 — a file that no longer exists, and whose successor does NOT do the conversion. Measured the same day: no caller in this repo converts any more, so there is nothing left to imitate. That is worth knowing rather than hiding: the trap is guarded by this comment alone, not by an example a reader could copy.
Kept in kilometres because it is published as
GeoLeaf.Utils.getDistance.