Reference · Markers on the globe
layoutPlacesfunction
Where each place's marker and name go in one picture. A place on the far side of the Earth, or off the picture, is left out; one near the Earth's edge fades. The stick stands up from the ground as the picture
sees it, leaning towards the top of the screen where the reader looks straight down on it, so it never shrinks to a dot; the ring at its foot is flattened as the ground is. A here place is taller and wider
than a favourite. Names go at the top of the stick, here first and then in the order given, never over one another or over a box in taken; a name with no free place is left out. With sun, each shape says
how far into the night its place is, so it can be drawn dimmer there.
Import it
import { layoutPlaces } from "@johnmorrisdotca/chikyu-earth/markers";
Definition
function layoutPlaces(places: readonly Place[], view: PlaceView, look: PlaceLook, options?: PlaceLayoutOptions): PlaceLayout
Parameters
| Name | Type | Description |
|---|---|---|
places | readonly Place[] | The places, as |
view | PlaceView | The picture. |
look | PlaceLook |
|
options (optional) | PlaceLayoutOptions | The size of each name, boxes already used, the most names (16) and where the Sun is overhead. |
Returns
PlaceLayout
The markers to draw and where the names go.
Examples
import { layoutPlaces, orthoView } from "@johnmorrisdotca/chikyu-earth/markers";
const view = orthoView({ lon: 139.69, lat: 35.69, radius: 200, cx: 210, cy: 210, width: 420, height: 420 });
const layout = layoutPlaces([{ id: "tokyo", lon: 139.69, lat: 35.69, label: "Tokyo", kind: "here" }], view, "beam", { size: () => ({ width: 48, height: 18 }) });
console.log(layout.shapes[0]?.length, layout.labels.length);25.3 1What it prints (run when this page was built)