Reference · The globe as an SVG string
routeLegfunction
Distance, bearings, midpoint and a flight-time estimate between two places. The distance quoted is the WGS84 geodesic.
The flight time is that distance at FLIGHT_SPEED_KM_H, an estimate with no wind.
Import it
import { routeLeg } from "@johnmorrisdotca/chikyu-earth";
Definition
function routeLeg(from: GeoPoint, to: GeoPoint): RouteLeg | null
Parameters
| Name | Type | Description |
|---|---|---|
from | GeoPoint | The start, degrees. |
to | GeoPoint | The end, degrees. |
Returns
RouteLeg | null
The leg, or null when a place is not on the Earth.
Examples
import { routeLeg } from "@johnmorrisdotca/chikyu-earth";
const leg = routeLeg({ lon: 0, lat: 0 }, { lon: 1, lat: 0 });
console.log(leg?.kilometres.toFixed(3), leg?.initialBearing);111.319 90What it prints (run when this page was built)