import { Geometry } from 'geojson'; /** Editor Layer Index source types we transform into MapLibre raster sources. */ type EliLayerType = 'tms' | 'wms' | 'wmts'; /** ELI rough categorisation, passed through for app-side filtering/UI. */ type EliCategory = 'photo' | 'map' | 'historicmap' | 'osmbasedmap' | 'historicphoto' | 'qa' | 'elevation' | 'other'; /** `[west, south, east, north]` in WGS84 degrees. */ type BBox = [number, number, number, number]; type EliContinent = 'africa' | 'antarctica' | 'asia' | 'europe' | 'north-america' | 'oceania' | 'south-america' | 'world'; /** Slim always-loaded row used for viewport/country filtering. */ type EliLocatorLayer = { id: string; name: string; type: EliLayerType; category?: EliCategory; best: boolean; overlay: boolean; minzoom?: number; maxzoom?: number; tileSize: number; scheme?: 'xyz' | 'tms'; geometryId: string; bbox: BBox; countryCodes: string[]; requiresKeys: string[]; /** Continents this layer is filed under (derived from countryCodes). Worldwide → ['world']. */ continents: EliContinent[]; }; /** Lazy detail fields merged onto a locator row to form a full EliLayer. */ type EliLayerDetails = { tiles: string[]; urlTemplate: string; availableProjections?: string[]; attributionHtml?: string; attributionText?: string; attributionUrl?: string; licenseUrl?: string; icon?: string; startDate?: string; endDate?: string; }; /** * One ELI layer, ready for MapLibre. Everything needed to render the imagery and * to filter by viewport is here — except the coverage polygon coordinates, which * live in continent-sharded `geometries/.json` (referenced by * {@link EliLocatorLayer.geometryId}). */ type EliLayer = EliLocatorLayer & EliLayerDetails; /** The slim, always-loaded locator file: filter fields only, no tile URLs. */ type EliLocatorIndex = { layers: EliLocatorLayer[]; }; /** Per-continent lazy detail shard: layer id → tile URLs, attribution, etc. */ type EliDetailsShard = Record; /** Router metadata for continent-sharded lazy loads. */ type EliShardsMeta = { continents: EliContinent[]; /** ISO alpha-2 → continent (no 'world'). */ countryToContinent: Record>; }; /** * Legacy monolithic index shape ({@link EliLayer}[] with details inline). Prefer * {@link EliLocatorIndex} + continent detail shards for new consumers. */ type EliIndex = { layers: EliLayer[]; }; /** Deduplicated coverage geometries by id (continent-sharded at rest). */ type EliGeometries = Record; /** * Precomputed area↔layer map: ISO region code → layer ids whose coverage touches * it, plus the special `"worldwide"` bucket for layers with no coverage polygon. * A ready-made spatial shortcut for consumers that don't want to build their own * index (e.g. iD/Rapid). */ type EliByCountry = Record; /** Build provenance, emitted next to the data. */ type EliManifest = { /** URL the imagery index was fetched from. */ source: string; /** HTTP ETag / Last-Modified from the imagery.geojson response, when available. */ sourceVersion: string | null; /** * Content commit SHA on `osmlab/editor-layer-index` (gh-pages), resolved from * the tip commit or its “Deploying to gh-pages from @…@SHA” message. */ sourceCommit?: string | null; /** ISO timestamp the data was generated. */ generatedAt: string; counts: { /** Layers present in the upstream index. */ upstream: number; /** Layers kept after dropping unsupported types. */ published: number; /** Unique geometries after deduplication. */ geometries: number; dropped: Record; /** Non-empty `details/.json` shards written. */ detailShards?: number; /** Non-empty `geometries/.json` shards written. */ geometryShards?: number; }; }; declare const ELI_API_KEYS: readonly ["apikey"]; /** * Names of API keys some ELI layers require (a typed union generated from the * data). Provide values for these to unlock and render the layers that need them. */ type EliApiKey = (typeof ELI_API_KEYS)[number]; /** Map of API-key name → value, e.g. `{ apikey: 'pk.…' }`. */ type EliApiKeys = Partial>; /** The full set of known API-key names (for building config UIs, docs, etc.). */ declare const eliApiKeyNames: readonly EliApiKey[]; /** True when every key a layer needs has a (non-empty) value in `apiKeys`. */ declare function hasRequiredKeys(requiresKeys: string[], apiKeys?: EliApiKeys): boolean; /** Substitute provided API keys into tile URL templates (other tokens untouched). */ declare function applyApiKeys(tiles: string[], apiKeys?: EliApiKeys): string[]; /** * Minimal structural types for the MapLibre style specs we emit. They're * intentionally self-contained (no `maplibre-gl` import) so the core stays * dependency-free, while remaining assignable to MapLibre's own * `RasterSourceSpecification` / `RasterLayerSpecification`. */ type RasterSourceSpec = { type: 'raster'; tiles: string[]; tileSize: number; scheme?: 'xyz' | 'tms'; minzoom?: number; maxzoom?: number; attribution?: string; }; type RasterLayerSpec = { id: string; type: 'raster'; source: string; minzoom?: number; maxzoom?: number; paint?: Record; }; /** Stable source/layer id derived from the ELI id (e.g. `eli-Mapbox`). */ declare function eliSourceId(layer: EliLayer | string): string; type RasterSourceOptions = { /** API keys to substitute into the tile URL templates (e.g. `{ apikey: '…' }`). */ apiKeys?: EliApiKeys; /** * Device pixel ratio for WMS GetMap WIDTH/HEIGHT. MapLibre's `{bbox-epsg-3857}` * always covers a logical `tileSize` CSS-pixel mercator tile; requesting a * larger image (e.g. 512 on a 2× display) keeps cadastral/WMS layers sharp. * Defaults to `min(devicePixelRatio, 2)` in the browser, else `1`. */ pixelRatio?: number; }; /** * Scale hardcoded WMS `WIDTH`/`HEIGHT` from the logical tile size to a denser * image size. TMS/WMTS URLs are returned unchanged (no server-side size knobs). */ declare function applyWmsPixelRatio(tiles: string[], tileSize: number, pixelRatio: number): string[]; /** Build a MapLibre `RasterSourceSpecification` for an ELI layer. */ declare function getRasterSourceSpec(layer: EliLayer, options?: RasterSourceOptions): RasterSourceSpec; type RasterLayerOptions = { /** Override the layer id (defaults to {@link eliSourceId}). */ id?: string; /** Source id this layer reads from (defaults to {@link eliSourceId}). */ source?: string; /** Raster paint overrides — styling is the app's job; this is just a default. */ paint?: Record; /** * When true, copy ELI `maxzoom` onto the style layer (hides the layer past that * zoom). Default false — source `maxzoom` alone makes MapLibre **overzoom** * the last available tiles instead of disappearing. */ clampMaxzoom?: boolean; }; /** Build a MapLibre `RasterLayerSpecification` referencing an ELI raster source. */ declare function getRasterLayerSpec(layer: EliLayer, options?: RasterLayerOptions): RasterLayerSpec; export { type BBox as B, type EliApiKeys as E, type RasterLayerOptions as R, type RasterSourceSpec as a, type RasterLayerSpec as b, type EliLayer as c, getRasterSourceSpec as d, eliSourceId as e, type EliApiKey as f, getRasterLayerSpec as g, type EliCategory as h, type EliContinent as i, type EliLayerDetails as j, type EliLayerType as k, type EliLocatorLayer as l, type EliShardsMeta as m, type RasterSourceOptions as n, applyApiKeys as o, applyWmsPixelRatio as p, eliApiKeyNames as q, hasRequiredKeys as r, type EliManifest as s, type EliByCountry as t, type EliGeometries as u, type EliDetailsShard as v, type EliIndex as w, type EliLocatorIndex as x };