import { type DemCell } from './tileIds'; import { type CogHeader } from './tiff'; /** One 1x1 degree GLO-30 cell once its header is known (`header` undefined means the bucket has no such tile: open ocean). */ export interface LoadedCell { cell: DemCell; id: string; url: string; header?: CogHeader; note?: string; /** Decoded internal tiles by tile index; undefined until fetched. NaN marks nodata. */ tiles: Array; /** Every byte range this build used (header at 0, then tiles), keyed by start offset: the cache-independent record the digest covers. */ ranges: Map; bytesFetched: number; } export declare function cellKey(cell: DemCell): number; /** Raster <-> geographic mapping of one cell's header. */ export interface CellGeometry { colOf(lon: number): number; rowOf(lat: number): number; lonOf(col: number): number; latOf(row: number): number; } /** * Copernicus GLO-30 COGs carry GTRasterTypeGeoKey = 2 (PixelIsPoint) with the tie point raster (0,0) -> (cell west lon, * cell north lat): sample (0,0) is CENTRED on the integer-degree north-west corner, so column c sits at lon = west + c * * scale. (Seen in the real N37 W123 and N46 E007 headers; GDAL reports the same file with a half-pixel-shifted geotransform * and AREA_OR_POINT=Point.) A PixelIsArea raster's tie point names the pixel CORNER, so its centre is half a pixel further in. */ export declare function cellGeometry(header: CogHeader): CellGeometry; /** * The cells as one continuous sample field. A sample is looked up in the cell that owns it (west edge inclusive, north * edge inclusive: the cell's row 0 sits ON its north degree line). The bilinear footprint of a sample near a seam reaches * one pixel into the neighbour; that pixel is the neighbour's nearest sample to the exact position (the neighbour may have * a coarser longitude posting at high latitude), so a seam interpolates across both tiles. If the neighbour was not loaded * the footprint clamps to the edge of its own cell instead; a missing (ocean) neighbour reads as 0 m. * * Two passes share this code: `collectNeeded` records which internal tiles a window touches without reading any, then the * caller fetches exactly those and runs `heightAt` for real. */ export declare class Mosaic { private readonly cells; /** Output samples that needed any nodata fill. */ filled: number; private collected; private readonly geometry; constructor(cells: Map); startCollecting(): void; /** Ends the collecting pass and returns, per cell, the internal tile indices it touched. */ finishCollecting(): Map>; private geometryOf; private cellAt; /** Bilinear height at lon/lat (0 over a missing tile); NaN never leaves. */ heightAt(lon: number, lat: number): number; /** The valid sample nearest `(col, row)` by Euclidean distance within a bounded search, walking square rings outward. */ private nearestValid; /** One source sample, crossing into the neighbouring cell when the index is off this cell's raster. NaN = nodata / not loaded. */ private pixel; private read; }