One Source Schema
Built-in terrain sources, library entries and your own sources are one record type, looked up by id in one place and resolved by one function.
A terrain source is the same record wherever it is listed: a Worldwide Default shipped with the app, a Library entry, or a source you added. Only where it surfaces differs. Imagery basemaps with a fixed tile address follow the same schema.
The record
lib/source-schema.ts defines it:
| Type | What it adds |
|---|---|
SourceEntryBase | What every source has: id, name, url, zoom range, tileSize, bounds, documentation, licence, and apiKey when the tiles need one |
TerrainSourceEntry | An elevation transport (type: terrarium, terrainrgb, cog, vrt, wms-raw, lerc, quantized-mesh, dem-diff, ...) and its decoding settings (nodata, RGB packing, difference operands) |
RasterSourceEntry | An imagery transport (type: tms, wms, wmts, cog, iiif, ...) and its display settings (role, opacity, scheme) |
section says where an entry surfaces: defaults (Worldwide Defaults, the built-in basemaps), library (the Library dialogs) or custom (your own list). The saved lists in your browser and the library file predate the field, so an entry without it is read from the list it sits in.
Ids never change: a shared link names a source by id (?terrainSourceA=mapterhorn, ?terrainSourceA=custom-global-gem15-dtm).
An apiKey names the setting whose value fills the {API_KEY} placeholder of url (entryUrl). A keyed source is hidden from the pickers until its key is set (hasEntryKey).
Where the entries are
| File | Entries |
|---|---|
lib/terrain-sources.ts | The built-in Worldwide Defaults: Mapterhorn, Esri, Mapbox, MapTiler, AWS, Cesium World Terrain |
lib/custom-sources.json | The Library. An entry with "section": "defaults" is also a Worldwide Default: GEM-15 DTM, last in the list |
lib/basemap-sources.ts | The built-in basemaps with a fixed address: Google Hybrid and Satellite, Bing, Esri, Mapbox, MapTiler, HERE |
Your browser (customTerrainSources, customBasemapSources) | Your own sources and the Library entries you added |
The dated imagery has an address per date rather than one address: it has its own schema, below. The OpenStreetMap vector style is not a tile source and stays outside both.
One lookup, one resolver
lib/terrain-catalog.ts holds the lookup: findTerrainSource(id, yourSources) returns your entry of that id, else the Worldwide Default. WORLDWIDE_DEFAULTS is the picker's list and visibleWorldwideDefaults(keys) the part of it your keys open.
Everything that reads a terrain source goes through that lookup, with no branch for built-ins:
| Reader | Resolver |
|---|---|
The map's terrain and hillshade source (TerrainSources) | buildRasterTileSource on the entry |
| The derived modes, the difference source, the elevation picker, the client export | terrainTileSpec (lib/terrain-tile-spec.ts) |
| Contours | buildTileUrl in ContoursLayer.tsx, then terrainTileSpec for the app's own schemes |
| GDAL commands (the info dialogs) and the titiler export | gdalTileSource |
| The tile service and the MCP server | terrainTileSpec, on the same entries written to tile-server/generated/library.json |
What GDAL can read
gdalTileSource gives GDAL a plain {z}/{x}/{y} pyramid when one exists. A Terrarium or Terrain-RGB pyramid is read as is, with its own tile size. A COG, a VRT or a raw WMS is read through titiler as Terrain-RGB tiles. LERC, quantized mesh, a difference, a cell-routed mosaic (GEM-15), STAC, MosaicJSON, TileJSON and local files are decoded by the app alone, so they have no GDAL command; the Download section exports them.
Dated imagery
A dated source maps a date and a place to tiles. DatedImagerySource (in lib/source-schema.ts) shares the source record's id, name, shortName, description, infoUrl and apiKey, and adds:
| Field | What it is |
|---|---|
section | defaults for the timeline's own sources, library for the national and regional series |
granularity | What a date is: a capture dated per tile (capture), a monthly, quarterly or yearly mosaic, a flight year or period (year), or the one current mosaic (current) |
realDates | false when the dates are a placeholder cadence (HLS: a tick a month, the mosaic of a 30-day window; Planetary Computer's monthly and quarterly mosaics) |
bounds, licence | Where a series has any date, and its licence (the national series) |
historicalEntry | Offered inside the sidebar's single Historical Imagery entry (Bing is a plain basemap there, with a pill on the timeline) |
tileSize, maxzoom | The tiles' size and the deepest zoom with real tiles: the map overzooms past it, the camera's ceiling follows it |
attribution | The constant string the map shows; the real per-place credit is in the sidebar's Source Info section, since a mounted source's attribution cannot change |
fixedDates(keys) | The dates known without a request (HLS's months, Planet's months with a key, EOX's years), for the timeline to show at once |
listDates(place, start, end, keys) | The catalog: every date at a place in a range |
tiles(tick, { keys, hd }) | The tiles of a date: the map's template, and for an export a plain https template, a tile fetcher or Bing's quadkey builder. null until the date can name them (a Wayback date before it is resolved to a release, a missing key) |
lib/dated-imagery.ts holds the six sources: Esri Wayback, NASA HLS, Google Earth historical, Planet monthly mosaics, EOX Sentinel-2 cloudless and Bing (its one current mosaic, dated by its capture date at the place). Their ids are the URL's (?historicalActiveSourceA=wayback).
The national and regional series of lib/national-historical.ts are dated sources too, in the library section: lib/national-dated.ts turns each one (an agency's flights such as Spain's PNOA or the Netherlands' PDOK, about seventy in all, Google Earth Timelapse, Landsat WELD, Planetary Computer's Landsat and Sentinel-2 mosaics) into a source whose dates are its layers' years, periods or months and whose tiles for a date are that layer (an XYZ template, a WMS GetMap with {bbox-epsg-3857}, or one of the app's schemes). Their listDates keeps the layers whose extent holds the place. ALL_DATED_IMAGERY_SOURCES lists both, and findDatedImagery finds either by id (cat-nat-pnoa, cat-nat-gtimelapse). A layer's basemap id (custom-basemap-cat-cat-nat-pnoa--PNOA2004) is the one the timeline gives it and a shared link rebuilds.
| Reader | What it takes from the schema |
|---|---|
The map's basemap (RasterBasemapSource) | tiles and maxzoom, for the view's date |
The multi-date export (lib/historical-export-sources.ts) | listDates, then tiles for each date; the current basemaps come from the built-in basemap entries |
| The timeline | fixedDates for HLS, Planet and EOX |
The MCP server's imagery_dates | listDates of every source with real dates and no key, the national series included (each date with its layer's basemap id, which open_view takes as imageryUrl) |
| The timeline's national catalogs | A layer's tiles (nationalLayerTiles); the catalog walk itself also asks the agency's flight index or probes a tile, to drop years flown elsewhere in the extent |
| The tile service | The registry, bundled in generated/app-lib.mjs |
Still outside it: the live per-place walks the timeline runs as React hooks for Wayback, Google Earth and Bing (debounced, cached, filled in progressively; listDates is their one-shot equivalent), and the per-place attribution hooks. The timeline's other catalogs (OpenAerialMap, Maxar, STAC, old maps...) are search results, each item with its own footprint and address rather than one source with a date, and stay with the catalogs.
Before the schema
Until 2026-11-23 the built-ins were a different shape ({ name, link, encoding, sourceConfig: { tiles, tileSize, maxzoom } }), and every reader branched on which shape it got. GEM-15 was shown among the defaults by a pinned row that copied the library entry into your own list before selecting it. That copy stays in the lists of those who picked it then; it is the same record, and your copy wins over the default.
Tile service (Scalar)
What the app draws, served as XYZ tiles and as pictures of a viewport over HTTP, from a Docker image; its addresses and parameters browsed with Scalar
QGIS Plugin (plan)
A QGIS plugin with the app's sidebar, in two steps - a panel that writes tile service layers, then the modes computed in Python with numpy.