Terrain Viewer

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:

TypeWhat it adds
SourceEntryBaseWhat every source has: id, name, url, zoom range, tileSize, bounds, documentation, licence, and apiKey when the tiles need one
TerrainSourceEntryAn elevation transport (type: terrarium, terrainrgb, cog, vrt, wms-raw, lerc, quantized-mesh, dem-diff, ...) and its decoding settings (nodata, RGB packing, difference operands)
RasterSourceEntryAn 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

FileEntries
lib/terrain-sources.tsThe built-in Worldwide Defaults: Mapterhorn, Esri, Mapbox, MapTiler, AWS, Cesium World Terrain
lib/custom-sources.jsonThe Library. An entry with "section": "defaults" is also a Worldwide Default: GEM-15 DTM, last in the list
lib/basemap-sources.tsThe 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:

ReaderResolver
The map's terrain and hillshade source (TerrainSources)buildRasterTileSource on the entry
The derived modes, the difference source, the elevation picker, the client exportterrainTileSpec (lib/terrain-tile-spec.ts)
ContoursbuildTileUrl in ContoursLayer.tsx, then terrainTileSpec for the app's own schemes
GDAL commands (the info dialogs) and the titiler exportgdalTileSource
The tile service and the MCP serverterrainTileSpec, 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:

FieldWhat it is
sectiondefaults for the timeline's own sources, library for the national and regional series
granularityWhat 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)
realDatesfalse 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, licenceWhere a series has any date, and its licence (the national series)
historicalEntryOffered inside the sidebar's single Historical Imagery entry (Bing is a plain basemap there, with a pill on the timeline)
tileSize, maxzoomThe tiles' size and the deepest zoom with real tiles: the map overzooms past it, the camera's ceiling follows it
attributionThe 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.

ReaderWhat 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 timelinefixedDates for HLS, Planet and EOX
The MCP server's imagery_dateslistDates 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 catalogsA 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 serviceThe 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.

On this page