Skip to the content

Chikyu Earth地球

A line-drawn globe of the world's countries that turns at the Earth's own rate, with an optional realistic Earth from space and markers for any place.

Chikyu is the Japanese word 地球 for the Earth. About the name

Contents

Reference · The data door: hand the package your own maps of the Earth or orbit data as a source with its own licence and credit, and see whose data is on the screen

createTileStorefunction

A tile store for a view: loads the tiles of every source by key and keeps them under one budget of bytes (default 48 MB, all sources together).

  • At most maxInFlight loads (6) run at once for a source, and a load starts only because the keys changed: at rest the store sends nothing, and a tile that failed waits for the next change.
  • The least recently used tile goes first when room is needed, and never a tile the view needs now. If a new tile does not fit even so, it is refused and counted: the held bytes never pass the budget (nor the count, if maxTiles is set).
  • A tile that throws, comes back empty or reports a size that is not a finite number is counted in failed and never held, so it is never drawn.
  • drop(sourceId) aborts the source's loads and frees its tiles.

Import it

import { createTileStore } from "@johnmorrisdotca/chikyu-earth/door";

Definition

function createTileStore<Tile>(options?: TileStoreOptions): TileStore<Tile>

Parameters

NameTypeDescription
options (optional)TileStoreOptions

Budget, loads in flight, and a callback for a redraw.

Returns

TileStore<Tile>

The store.

Examples

import { createTileStore } from "./data-door.ts";

const store = createTileStore<Tile>({ onChange: draw });
const held = store.want(source, source.need(place, detail)); // draws what is held now; the rest arrives through onChange
store.drop(source.info.id); // the layer is switched off

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/chikyu-earth 0.51.1.