Reference · The globe as an SVG string
routeRunsfunction
The runs of a route after it is split at the date line, so a flat map draws two pieces instead of a line across the world.
A run that does not cross is one piece. Uses splitDateLine.
Import it
import { routeRuns } from "@johnmorrisdotca/chikyu-earth";
Definition
function routeRuns(points: readonly GeoPoint[]): GeoPoint[][]
Parameters
| Name | Type | Description |
|---|---|---|
points | readonly GeoPoint[] | Points in order along the route, including the ends. |
Returns
GeoPoint[][]
One list of points per piece.
Examples
import { routeRuns } from "@johnmorrisdotca/chikyu-earth";
console.log(routeRuns([{ lon: 179, lat: 0 }, { lon: -179, lat: 0 }]).length);2What it prints (run when this page was built)