Skip to content
Code Recycle

Component · for humans & their agents

Geodesic Distance & Antimeridian-Safe Boxes

verified · first-partyactively maintained$0 during beta (was $49)

A bounding box crossing the antimeridian silently contains NOTHING, and Euclidean degrees are wrong everywhere.

by nightowl · Code Recycle maintainer

Get it free — beta

Every claim on this page is refundable if it is untrue — refund policy.

Verified: 89 tests

Haversine distance, initial bearing, and bounding-box containment, union and intersection that survive the antimeridian and the poles.

Haversine distance, initial bearing, and bounding-box containment, union and intersection that survive the antimeridian and the poles.

THE SILENT FAILURE. Naive code treats latitude and longitude as a plane. Euclidean distance on degrees is wrong everywhere and badly wrong away from the equator, because a degree of longitude shrinks toward the poles -- but it returns a plausible number, so nearest-location features ship subtly wrong for years. A bounding box crossing the ANTIMERIDIAN has minLon greater than maxLon, and naive containment returns FALSE for every point inside it, so a region near Fiji or the Aleutians silently contains nothing at all.

The mean Earth radius is cited to its source, and the accuracy limit versus an ellipsoidal model is stated rather than glossed -- overclaiming precision is the failure mode of every competing snippet. Distance is tested differentially against an independently written Vincenty implementation. Out-of-range latitude is REFUSED, never clamped, because clamping fabricates a location. Where a true intersection is two disjoint arcs and cannot be expressed as one box, it throws rather than silently discarding one.

An independent verifier found the shipped README quoted a bearing 8 degrees off the code's real output, and the test covering it asserted a range too wide to catch that. Both corrected; the assertion is now tight enough to fail.

VERIFIED: 89 tests. Every mutation was observed FAILING before the source was restored -- a test never seen to fail is a decoration. This product was also reviewed by an independent verifier whose job was to find what is wrong, not to agree.

DELIVERY: signed download of a hash-verified tarball, immediately on purchase. Permissive licence: unlimited products, unlimited clients, unlimited seats, no attribution, perpetual and irrevocable. One restriction, do not republish the source as source.

Interface

What you call, and what comes back. Types and signatures only — the implementation ships with the source.

  export function crossesAntimeridian(bbox: Bbox): boolean;
  export function bboxContainsPoint(bbox: Bbox, point: Point): boolean;
  export function bboxUnion(a: Bbox, b: Bbox): Bbox;
  export function bboxIntersection(a: Bbox, b: Bbox): Bbox | null;
  export function initialBearingDegrees(a: Point, b: Point): number;
  export function toRadians(degrees: number): number;
  export function haversineDistanceMeters(a: Point, b: Point, options: HaversineOptions = {}): number;
  export function isValidLatitude(lat: unknown): lat is number;
  export function isValidLongitude(lon: unknown): lon is number;
  export function assertValidPoint(p: Point): void;
  export function normalizeLongitude(lon: number): number;
  export function createPoint(lat: number, lon: number): Point;

01Capabilities

Does

  • + Geospatial

Doesn’t

  • No exclusions declared

02Requirements & stack

Depends on

No declared dependencies

Credentials needed

None declared

Stack

typescript

03Community

No endorsements yet

No verified confirmations yet — be the first.

Confirmations come from verified purchasers, installers, vetted reviewers, or an installation outcome your org reported through the agent tools. They grade quality — security is verified separately, and community votes can never override the security gate.

Open an issue

Sign in to confirm — weight comes from verified usage, not vote count.

0 open · 0 answered · 0 fixed · 1 said it worked

04Trust Passport

Full passport →
–/100

0/0 automated components pass. An automated score is never a security guarantee.

✓ Verified · first-partyreviewed Sep 20, 2026 · re-verification due Dec 19, 2026
  • publisher identity Publisher status verified; 1 verification(s) on file
  • malicious pattern scan No known malicious-behavior patterns across 16 source file(s) plus listing text
  • capability contract All 0 observed capability reference(s) match the declared manifest
  • agent safety scan No injection patterns in agent-readable content
  • provenance No release signature or provenance attestation
  • behavioral sandbox Not performed in this environment — requires the production isolated runner (docs/sandbox-requirements.md). No untrusted code is ever executed on the application host.

Every listing must pass this review before it can be sold, and it is re-run on every release. Verification describes what we checked — it is not a guarantee that the software is safe.

VersionChannelReleasedNotes
1.0.0stableAug 4, 2026First public release.