/** * NASA GIBS (Global Imagery Browse Services) basemap client — the opaque * land/water base plus a transparent coastline/border outline layer, fetched * and stitched into one 512px composite for the radar-imagery overlay path. * * See `docs/plans/composited-imagery-plan.md` (D2, D6) and * `docs/plans/composited-imagery-implementation-plan.md` ("Findings that shape the * graph") for why this shape: * * - **GIBS tile matrix sets are layer-specific.** `src/services/gibs.ts` * hardcodes `GoogleMapsCompatible_Level7` for the GeoColor satellite * layer, but that constant does not apply here — a wrong matrix set * returns HTTP 400 `InvalidParameterValue TILEMATRIXSET` (verified * live). `OSM_Land_Water_Map` uses `GoogleMapsCompatible_Level9`; * `Reference_Features_15m` uses `GoogleMapsCompatible_Level13`. Each * layer therefore carries its own matrix set constant below rather than * sharing one. * - **WMTS REST path order is `{z}/{row=y}/{col=x}`** — y before x — same * convention as `gibs.ts`. * - Output is a window **centered on the requested coordinates**, not a * whole tile, so a location never lands against the edge of its own map. * The covering 256px tiles at zoom `z+1` are assembled and cropped * (`assembleTiles`/`cropTo`, from `src/utils/composite.ts`) — pixel-exact, * no resampling, since zoom `z+1` at 256px is the same grid as zoom `z` * at 512px. * - The land/water layer is opaque (`flattenOpaque` forces alpha 255 after * stitching, since GIBS occasionally emits antialiased seam pixels with * alpha < 255); the features layer is intentionally transparent and is * `blendOnto` the base afterward. * - **Composite failures are garnish, not contract** (ACIS/NIFC * precedent — see Findings): this service throws plain `Error`s, no * retry ladder, no custom `ApiError` subclass. The imagery handler * catches everything from this path and degrades to the normal * URL-based text output. * * Raw tile buffers are cached individually, keyed `layer/z/y/x`, at * `CacheConfig.ttl.basemapTiles` — near-static reference layers, so caching * hard is safe and keeps repeat composites to zero additional GIBS fetches. */ import { PNG } from '../utils/composite.js'; /** A GIBS layer's name and its (layer-specific) WMTS tile matrix set. */ interface GibsLayer { readonly name: string; readonly matrixSet: string; /** * When true, a **404** for one of this layer's tiles is treated as an empty * transparent tile instead of failing the composite — see * `MISSING_OPTIONAL_TILE`. */ readonly optional?: boolean; } /** Opaque land/water base layer — required; without it there is no map. */ export declare const BASE_LAYER: GibsLayer; /** * Transparent coastline/border outline layer, blended over the base. * * Marked optional because GIBS does not serve a tile everywhere: at extreme * polar rows there is no coastline or border to draw and the tile 404s * (observed live at `7/1/63` and `7/126/63`). Losing decorative outlines is * not a reason to lose the whole map, so a 404 here degrades to a blank tile. * **Only 404 is tolerated** — a wrong tile matrix set returns 400, which must * still fail loudly rather than silently rendering a base-only map. */ export declare const FEATURES_LAYER: GibsLayer; export declare class BasemapService { private client; private cache; constructor(); /** * Fetch one raw tile buffer, serving from cache when available. Any * network/HTTP failure is rethrown as a plain `Error` (garnish precedent — * see module doc comment); there is no retry ladder. * @private */ private fetchTile; /** * Fetch a single layer's tiles covering `window` and assemble them into one * image (uncropped — the caller crops once, after blending). * @private */ private fetchLayerWindow; /** * Build the base map for a `size`×`size` window whose top-left corner sits * at global pixel `(gx0, gy0)` in the zoom-`z` pixel space (see * `worldPixelSize` in `src/utils/composite.ts`). * * Fetches the covering tiles of `BASE_LAYER` and `FEATURES_LAYER` at zoom * `z + 1` (2x2 to 3x3 per layer depending on how the window straddles tile * boundaries — individually cached, so neighbouring requests and repeat * calls mostly hit cache), assembles each layer, flattens the land/water * base opaque, blends the outline layer over it, and crops to the window. * * Both layers' fetches run concurrently. If any tile fails the whole call * rejects — no partial base map is ever returned. */ getBaseWindow(z: number, gx0: number, gy0: number, size: number): Promise; } export declare const basemapService: BasemapService; export {}; //# sourceMappingURL=basemap.d.ts.map