EarthMapSourcetype
A source of the Earth's map in tiles for one layer (or every layer of a folder): a TileSource of the family's map shape (the place is a MapPlace, the detail is the pixels across the whole circumference, a tile is an
ImageTile) that says which layer it is for. A layer of "*" is every layer of a folder (the place then names the one, in place.layer, and the keys start with its name). The keys a source returns end in
level/column/row on the package's pyramid. levels says which levels the source has when that has to be asked (a folder's manifest); left out, levels 3 and 4.
Import it
import type { EarthMapSource } from "@johnmorrisdotca/chikyu-earth/door";
Definition
type EarthMapSource = TileSource<EarthMapPlace, number, ImageTile> & {
layer: MapLayer | "*";
levels?(layer: string, signal: AbortSignal): TileLayer | undefined | Promise<TileLayer | undefined>;
grid?: MapGrid;
holes?: boolean;
look?: {
clear: readonly [
number,
number
];
gain?: readonly [
number,
number,
number
];
};
};
Members
| Name | Type | Description |
|---|---|---|
kind | "tiles" | |
info | SourceInfo | |
need | (place: EarthMapPlace, detail: number): readonly string[] | The keys of the tiles a place needs at a detail. Pure: no fetching. |
load | (key: string, signal: AbortSignal): Promise<ImageTile> | Loads one tile. The source may use the network or not; it must stop when the signal aborts. |
bytes | (tile: ImageTile): number | The tile's size in memory, in bytes, for the budget. |
layer | MapLayer | "*" | |
levels (optional) | ((layer: string, signal: AbortSignal) => TileLayer | undefined | Promise<TileLayer | undefined>) | undefined | |
grid (optional) | MapGrid | undefined | The source's own grid, when it is not the package's pyramid ( |
holes (optional) | boolean | undefined | True when the source's tiles may have transparent pixels (a place it has no data for), so the loader draws them blended and the picture underneath shows through. |
look (optional) | { clear: readonly [number, number]; gain?: readonly [number, number, number]; } | undefined | How the loader draws this source's tiles, on the graphics card: |
Examples
import type { EarthMapSource } from "@johnmorrisdotca/chikyu-earth/door";
const layers = (sources: readonly EarthMapSource[]): string[] => sources.map((source) => source.layer);
console.log(layers([]));[]What it prints (run when this page was built)