Reference · The place under a point: country, sea, continent and the nearest city
alongTrackfunction
The ordered changes of place along a ground track. Each point is { lon, lat, t }.
A change is reported at the sample that entered the new place. near is how a page says the track is approaching a country; the next sample inside it is the country itself.
Import it
import { alongTrack } from "@johnmorrisdotca/chikyu-earth/place";
Definition
function alongTrack(points: readonly { lon: number; lat: number; t: number; }[], options?: PlaceOptions): TrackChange[]
Parameters
| Name | Type | Description |
|---|---|---|
points | readonly { lon: number; lat: number; t: number; }[] | The track, in order. A point with no latitude is skipped. |
options (optional) | PlaceOptions | undefined | The same city lists as |
Returns
TrackChange[]
One row for the first sample, then one row each time the country, the nearby country or the sea changes.
Examples
import { alongTrack } from "@johnmorrisdotca/chikyu-earth/place";
const rows = alongTrack([
{ lon: -40, lat: 40, t: 0 },
{ lon: -3.7, lat: 40.4, t: 1 },
{ lon: 2.35, lat: 48.86, t: 2 },
]);
console.log(rows.map((row) => row.entering?.id).join(" "));atlantic-ocean ES FRWhat it prints (run when this page was built)