distanceKmfunction
The great-circle distance between two points, in kilometres, on a sphere of the earth's mean radius (6,371 km). Within about half a percent of the distance on the ground.
Import it
import { distanceKm } from "@johnmorrisdotca/kuni/facts";
Definition
function distanceKm(from: LatLon, to: LatLon): number
Parameters
| Name | Type | Description |
|---|---|---|
from | LatLon | A point, |
to | LatLon | Another point. |
Returns
number
The distance in kilometres.
Examples
import { distanceKm, facts } from "@johnmorrisdotca/kuni/facts";
console.log(Math.round(distanceKm(facts("JP")!.capitalPoint!, facts("GB")!.capitalPoint!))); // 95589558What it prints (run when this page was built)