maplibre-gl-raster 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +362 -0
  3. package/dist/LercDecode.es-CZm5toNk.js +442 -0
  4. package/dist/LercDecode.es-CZm5toNk.js.map +1 -0
  5. package/dist/RasterControl-B7XdXYSu.js +18838 -0
  6. package/dist/RasterControl-B7XdXYSu.js.map +1 -0
  7. package/dist/__vite-browser-external-BgMKmFg9.js +9 -0
  8. package/dist/__vite-browser-external-BgMKmFg9.js.map +1 -0
  9. package/dist/assets/LercDecode.es-Bvg6-wb5.js +442 -0
  10. package/dist/assets/LercDecode.es-Bvg6-wb5.js.map +1 -0
  11. package/dist/assets/__vite-browser-external-BgMKmFg9.js +9 -0
  12. package/dist/assets/__vite-browser-external-BgMKmFg9.js.map +1 -0
  13. package/dist/assets/chunk-FDOR9p9I.js +24 -0
  14. package/dist/assets/decode-BvR5vy7g.js +940 -0
  15. package/dist/assets/decode-BvR5vy7g.js.map +1 -0
  16. package/dist/assets/lerc-By2TvjAX.js +34 -0
  17. package/dist/assets/lerc-By2TvjAX.js.map +1 -0
  18. package/dist/assets/lzw-CQJJDca2.js +174 -0
  19. package/dist/assets/lzw-CQJJDca2.js.map +1 -0
  20. package/dist/assets/worker-C6cg9T3Y.js +51 -0
  21. package/dist/assets/worker-C6cg9T3Y.js.map +1 -0
  22. package/dist/assets/zstd-DBZv9xja.js +569 -0
  23. package/dist/assets/zstd-DBZv9xja.js.map +1 -0
  24. package/dist/chunk-FDOR9p9I.js +24 -0
  25. package/dist/decode-BMFOVF9X.js +1966 -0
  26. package/dist/decode-BMFOVF9X.js.map +1 -0
  27. package/dist/index.mjs +223 -0
  28. package/dist/index.mjs.map +1 -0
  29. package/dist/lerc-B7WY-v3y.js +34 -0
  30. package/dist/lerc-B7WY-v3y.js.map +1 -0
  31. package/dist/lzw-YEsReV21.js +174 -0
  32. package/dist/lzw-YEsReV21.js.map +1 -0
  33. package/dist/maplibre-gl-raster.css +670 -0
  34. package/dist/react.mjs +145 -0
  35. package/dist/react.mjs.map +1 -0
  36. package/dist/types/index.d.ts +649 -0
  37. package/dist/types/react.d.ts +477 -0
  38. package/dist/zstd-DBZv9xja.js +569 -0
  39. package/dist/zstd-DBZv9xja.js.map +1 -0
  40. package/package.json +125 -0
@@ -0,0 +1,649 @@
1
+ import { default as colormapsPngUrl } from '@developmentseed/deck.gl-raster/gpu-modules/colormaps.png';
2
+ import { GeoTIFF } from '@developmentseed/geotiff';
3
+ import { IControl } from 'maplibre-gl';
4
+ import { Map as Map_2 } from 'maplibre-gl';
5
+
6
+ /**
7
+ * Options for {@link AddRasterOptions} consumers (RasterControl.addRaster).
8
+ */
9
+ export declare interface AddRasterOptions {
10
+ /** Layer id; auto-generated when omitted. */
11
+ id?: string;
12
+ /** Display name; derived from the URL / file name when omitted. */
13
+ name?: string;
14
+ /** Initial visualization state overrides (mode/bands default from the
15
+ * loaded band count). */
16
+ state?: Partial<RasterLayerState>;
17
+ /** Fit the map to the raster's bounds once loaded. @default true */
18
+ zoomTo?: boolean;
19
+ /** Id of an existing map style layer to insert the raster beneath (e.g. a
20
+ * symbol layer so labels stay readable). Drawn on top when omitted or when
21
+ * the layer does not exist. */
22
+ beforeId?: string;
23
+ }
24
+
25
+ export declare type AutoStats = {
26
+ /** 1-indexed band → stats map. Null when stats are unknown. */
27
+ perBand: Map<number, BandStats> | null;
28
+ /** A reasonable global stats block to fall back on (averaged min/max,
29
+ * summed histogram bins). */
30
+ global: BandStats | null;
31
+ };
32
+
33
+ export declare type BandStats = {
34
+ min: number;
35
+ max: number;
36
+ /** Bin counts evenly distributed over [min, max]. Length = HISTOGRAM_BINS. */
37
+ histogram: number[];
38
+ };
39
+
40
+ export declare type BandSummary = {
41
+ /** 1-based band index. */
42
+ index: number;
43
+ /** Human label from `<Item name="DESCRIPTION" sample="N-1">…</Item>` or
44
+ * the `BAND_NAME` alias. */
45
+ name: string | null;
46
+ /** GDAL scale; defaults to 1. */
47
+ scale: number;
48
+ /** GDAL offset; defaults to 0. */
49
+ offset: number;
50
+ /** Per-band nodata (currently always the dataset-level value — TIFF
51
+ * doesn't carry per-band nodata in the common path). */
52
+ nodata: number | null;
53
+ /** Author-supplied min/max/mean/std/validPercent from `STATISTICS_*` items. */
54
+ stats: {
55
+ min: number | null;
56
+ max: number | null;
57
+ mean: number | null;
58
+ std: number | null;
59
+ validPercent: number | null;
60
+ } | null;
61
+ };
62
+
63
+ /**
64
+ * Clamps a value between a minimum and maximum.
65
+ *
66
+ * @param value - The value to clamp
67
+ * @param min - The minimum allowed value
68
+ * @param max - The maximum allowed value
69
+ * @returns The clamped value
70
+ *
71
+ * @example
72
+ * ```typescript
73
+ * clamp(5, 0, 10); // returns 5
74
+ * clamp(-5, 0, 10); // returns 0
75
+ * clamp(15, 0, 10); // returns 10
76
+ * ```
77
+ */
78
+ export declare function clamp(value: number, min: number, max: number): number;
79
+
80
+ /**
81
+ * Creates a CSS class string from an object of class names.
82
+ *
83
+ * @param classes - Object with class names as keys and boolean values
84
+ * @returns A space-separated string of class names
85
+ *
86
+ * @example
87
+ * ```typescript
88
+ * classNames({ active: true, disabled: false, visible: true });
89
+ * // returns "active visible"
90
+ * ```
91
+ */
92
+ export declare function classNames(classes: Record<string, boolean>): string;
93
+
94
+ /** Alphabetical list of the named colormaps shipped in the sprite. */
95
+ export declare const COLORMAP_NAMES: string[];
96
+
97
+ /** Picker-ready options: name, display label, and the sprite row to
98
+ * preview. */
99
+ export declare const COLORMAP_OPTIONS: ColormapOption[];
100
+
101
+ /** Number of rows in the colormap sprite. */
102
+ export declare const COLORMAP_ROW_COUNT: number;
103
+
104
+ export declare type ColormapOption = {
105
+ name: string;
106
+ label: string;
107
+ rowIndex: number;
108
+ reversed?: boolean;
109
+ };
110
+
111
+ export { colormapsPngUrl }
112
+
113
+ /** Compute auto-stats for a GeoTIFF. Prefers author-supplied min/max
114
+ * from GDAL_METADATA when present (cheap, exact, anchors the rescale
115
+ * window to whatever the author intended) and uses sampled tiles to
116
+ * populate the histogram bins around that range. Without GDAL stats,
117
+ * derives min/max from the same samples in a two-pass scan. Falls back
118
+ * to GDAL min/max with empty histograms only if sampling fails entirely.
119
+ *
120
+ * When `onProgress` is supplied AND GDAL priors are present, the
121
+ * histogram fills in tile-by-tile and `onProgress` fires with a partial
122
+ * AutoStats snapshot after each tile is binned. Without priors, the
123
+ * callback never fires (bin edges aren't stable until both passes
124
+ * finish); the caller still receives the final stats via the resolved
125
+ * Promise. Caller guards against stale results. */
126
+ export declare function computeAutoStats(tiff: GeoTIFF, signal: AbortSignal, onProgress?: (partial: AutoStats) => void): Promise<AutoStats>;
127
+
128
+ export declare type CrsSummary = {
129
+ /** EPSG code when the COG declares one; null for user-defined CRSes. */
130
+ code: number | null;
131
+ /** Display label: `"EPSG:3857"` or `"User-defined: <name>"`. */
132
+ label: string;
133
+ /** `GTCitationGeoKey` or projected / geodetic citation, when present. */
134
+ citation: string | null;
135
+ /** Geographic-or-projected bbox `[minX, minY, maxX, maxY]` in the CRS. */
136
+ bbox: [number, number, number, number];
137
+ /** `ModelPixelScale` `[scaleX, scaleY]` when present. */
138
+ pixelScale: [number, number] | null;
139
+ };
140
+
141
+ /**
142
+ * Debounces a function call.
143
+ *
144
+ * @param fn - The function to debounce
145
+ * @param delay - The delay in milliseconds
146
+ * @returns A debounced version of the function
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const debouncedUpdate = debounce(() => updateMap(), 100);
151
+ * window.addEventListener('resize', debouncedUpdate);
152
+ * ```
153
+ */
154
+ export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
155
+
156
+ /**
157
+ * Formats a numeric value with appropriate decimal places based on step size.
158
+ *
159
+ * @param value - The value to format
160
+ * @param step - The step size to determine decimal places
161
+ * @returns The formatted value as a string
162
+ *
163
+ * @example
164
+ * ```typescript
165
+ * formatNumericValue(5, 1); // returns "5"
166
+ * formatNumericValue(0.5, 0.1); // returns "0.5"
167
+ * formatNumericValue(0.55, 0.01); // returns "0.55"
168
+ * ```
169
+ */
170
+ export declare function formatNumericValue(value: number, step: number): string;
171
+
172
+ /** A single `<Item>` from `<GDALMetadata>`. `sample` is 1-based when present
173
+ * (GDAL writes 0-based; we normalize). `role` is the optional `role` attribute
174
+ * (e.g. `"description"`). */
175
+ export declare type GdalItem = {
176
+ name: string;
177
+ value: string;
178
+ sample: number | null;
179
+ role: string | null;
180
+ };
181
+
182
+ /**
183
+ * Generates a unique ID string.
184
+ *
185
+ * @param prefix - Optional prefix for the ID
186
+ * @returns A unique ID string
187
+ *
188
+ * @example
189
+ * ```typescript
190
+ * generateId('control'); // returns "control-abc123"
191
+ * generateId(); // returns "abc123"
192
+ * ```
193
+ */
194
+ export declare function generateId(prefix?: string): string;
195
+
196
+ export declare type ImageSummary = {
197
+ width: number;
198
+ height: number;
199
+ bandCount: number;
200
+ dtype: string;
201
+ photometric: string;
202
+ compression: string;
203
+ predictor: string | null;
204
+ planarConfig: string;
205
+ tileWidth: number;
206
+ tileHeight: number;
207
+ nodata: number | null;
208
+ };
209
+
210
+ /**
211
+ * Open a GeoTIFF from a URL (http(s) or blob:). Equivalent to
212
+ * `GeoTIFF.fromUrl(url)` plus the CORS workaround above. Dedupes concurrent
213
+ * requests for the same URL so double-invoked effects don't kick off two
214
+ * parallel reads; entries are dropped once settled so the map stays bounded.
215
+ */
216
+ export declare function loadGeoTIFF(url: string): Promise<GeoTIFF>;
217
+
218
+ /** Upper bound on tiles read from the coarsest IFD during auto-stats. For
219
+ * properly-pyramided COGs the coarsest level is just a few tiles and the
220
+ * cap never trips. For COGs without a deep overview pyramid (so the
221
+ * coarsest is the primary at full size), the cap keeps layer-load from
222
+ * trying to download the entire image. */
223
+ export declare const MAX_SAMPLE_TILES = 64;
224
+
225
+ /** Structural subset of `GeoTIFF` we read from. Lets tests construct stubs
226
+ * without instantiating the whole class. The real `GeoTIFF` satisfies this. */
227
+ declare type MetadataInput = Pick<GeoTIFF, 'image' | 'width' | 'height' | 'count' | 'tileWidth' | 'tileHeight' | 'nodata' | 'crs' | 'bbox' | 'cachedTags' | 'gkd' | 'offsets' | 'scales' | 'storedStats' | 'overviews'>;
228
+
229
+ export declare type MetadataSummary = {
230
+ image: ImageSummary;
231
+ crs: CrsSummary;
232
+ overviews: OverviewSummary[];
233
+ bands: BandSummary[];
234
+ /** GDAL `<Item>` entries that aren't already shown under Bands
235
+ * (i.e. excludes `STATISTICS_*`, `DESCRIPTION`, `BAND_NAME`).
236
+ * Dataset-level items first, then per-band, in document order. */
237
+ gdalItems: GdalItem[];
238
+ rawGdalXml: string | null;
239
+ };
240
+
241
+ export declare type OverviewSummary = {
242
+ width: number;
243
+ height: number;
244
+ tileWidth: number;
245
+ tileHeight: number;
246
+ tileCount: {
247
+ x: number;
248
+ y: number;
249
+ };
250
+ };
251
+
252
+ /** Sentinel colormap name for the image's embedded color table. */
253
+ export declare const PALETTE_COLORMAP = "palette";
254
+
255
+ /**
256
+ * Linear-interpolated percentile from a histogram. `p` is in [0, 1]. Used
257
+ * to derive default rescale ranges (typically [0.02, 0.98]) without storing
258
+ * raw samples.
259
+ */
260
+ export declare function percentileFromHistogram(stats: BandStats, p: number): number;
261
+
262
+ /**
263
+ * A MapLibre GL control for visualizing local and remote raster datasets
264
+ * (GeoTIFF / Cloud Optimized GeoTIFF). A collapsible button expands into a
265
+ * panel with an "Add data" section (URL or local file), a layer list, and
266
+ * per-layer rendering settings (bands, rescale histograms, colormaps,
267
+ * nodata, stretch, gamma, opacity). Rendering uses a deck.gl COGLayer
268
+ * pipeline on a shared MapboxOverlay.
269
+ *
270
+ * @example
271
+ * ```typescript
272
+ * const control = new RasterControl({ collapsed: false });
273
+ * map.addControl(control, 'top-right');
274
+ * await control.addRaster('https://example.com/data/cog.tif');
275
+ * ```
276
+ */
277
+ export declare class RasterControl implements IControl {
278
+ private _map?;
279
+ private _mapContainer?;
280
+ private _container?;
281
+ private _panel?;
282
+ private _options;
283
+ private _state;
284
+ private _eventHandlers;
285
+ private _layerManager?;
286
+ private _panelUI?;
287
+ private _onReady;
288
+ private _resizeHandler;
289
+ private _mapResizeHandler;
290
+ private _clickOutsideHandler;
291
+ /**
292
+ * Creates a new RasterControl instance.
293
+ *
294
+ * @param options - Configuration options for the control
295
+ */
296
+ constructor(options?: Partial<RasterControlOptions>);
297
+ /**
298
+ * Called when the control is added to the map.
299
+ * Implements the IControl interface.
300
+ *
301
+ * @param map - The MapLibre GL map instance
302
+ * @returns The control's container element
303
+ */
304
+ onAdd(map: Map_2): HTMLElement;
305
+ /**
306
+ * Called when the control is removed from the map.
307
+ * Implements the IControl interface.
308
+ */
309
+ onRemove(): void;
310
+ /**
311
+ * Gets the current state of the control.
312
+ *
313
+ * @returns The current plugin state
314
+ */
315
+ getState(): RasterControlState;
316
+ /**
317
+ * Updates the control state.
318
+ *
319
+ * @param newState - Partial state to merge with current state
320
+ */
321
+ setState(newState: Partial<RasterControlState>): void;
322
+ /**
323
+ * Toggles the collapsed state of the control panel.
324
+ */
325
+ toggle(): void;
326
+ /**
327
+ * Expands the control panel.
328
+ */
329
+ expand(): void;
330
+ /**
331
+ * Collapses the control panel.
332
+ */
333
+ collapse(): void;
334
+ /**
335
+ * Registers an event handler.
336
+ *
337
+ * @param event - The event type to listen for
338
+ * @param handler - The callback function
339
+ */
340
+ on(event: RasterControlEvent, handler: RasterControlEventHandler): void;
341
+ /**
342
+ * Removes an event handler.
343
+ *
344
+ * @param event - The event type
345
+ * @param handler - The callback function to remove
346
+ */
347
+ off(event: RasterControlEvent, handler: RasterControlEventHandler): void;
348
+ /**
349
+ * Gets the map instance.
350
+ *
351
+ * @returns The MapLibre GL map instance or undefined if not added to a map
352
+ */
353
+ getMap(): Map_2 | undefined;
354
+ /**
355
+ * Gets the control container element.
356
+ *
357
+ * @returns The container element or undefined if not added to a map
358
+ */
359
+ getContainer(): HTMLElement | undefined;
360
+ /**
361
+ * Adds a raster layer from a remote COG URL or a local GeoTIFF File.
362
+ *
363
+ * The returned promise resolves with the layer id once the GeoTIFF header
364
+ * loads (waiting for the control to be added to a map first, if needed)
365
+ * and rejects when loading fails.
366
+ *
367
+ * @param source - COG URL or a local GeoTIFF File
368
+ * @param options - Id/name/state overrides and zoom behavior
369
+ * @returns The new layer's id
370
+ */
371
+ addRaster(source: string | File, options?: AddRasterOptions): Promise<string>;
372
+ /**
373
+ * Removes a raster layer.
374
+ *
375
+ * @param id - The layer id
376
+ */
377
+ removeRaster(id: string): void;
378
+ /**
379
+ * Gets a snapshot of one raster layer.
380
+ *
381
+ * @param id - The layer id
382
+ * @returns Layer info, or undefined when unknown
383
+ */
384
+ getRaster(id: string): RasterLayerInfo | undefined;
385
+ /**
386
+ * Gets snapshots of all raster layers in draw order (first = bottom).
387
+ *
388
+ * @returns Layer info array
389
+ */
390
+ getRasters(): RasterLayerInfo[];
391
+ /**
392
+ * Merges a partial visualization state into a layer (bands, rescale,
393
+ * colormap, nodata, opacity, gamma, stretch, visible).
394
+ *
395
+ * @param id - The layer id
396
+ * @param patch - State fields to update
397
+ */
398
+ setRasterState(id: string, patch: Partial<RasterLayerState>): void;
399
+ /**
400
+ * Shows or hides a raster layer.
401
+ *
402
+ * @param id - The layer id
403
+ * @param visible - Whether the layer should render
404
+ */
405
+ setVisible(id: string, visible: boolean): void;
406
+ /**
407
+ * Selects the layer whose settings the panel edits.
408
+ *
409
+ * @param id - The layer id, or null to clear the selection
410
+ */
411
+ selectRaster(id: string | null): void;
412
+ /**
413
+ * Fits the map view to a layer's bounds.
414
+ *
415
+ * @param id - The layer id
416
+ */
417
+ zoomToRaster(id: string): void;
418
+ /**
419
+ * Moves a layer to a new position in the draw order.
420
+ *
421
+ * @param id - The layer id
422
+ * @param toIndex - Target index (0 = bottom)
423
+ */
424
+ reorderRaster(id: string, toIndex: number): void;
425
+ /** Re-emits LayerManager events through the control's event system. */
426
+ private _forwardLayerManagerEvents;
427
+ /**
428
+ * Emits an event to all registered handlers.
429
+ *
430
+ * @param event - The event type to emit
431
+ * @param extra - Optional layerId/error payload for raster events
432
+ */
433
+ private _emit;
434
+ /**
435
+ * Creates the main container element for the control.
436
+ * Contains a toggle button (29x29) matching navigation control size.
437
+ *
438
+ * @returns The container element
439
+ */
440
+ private _createContainer;
441
+ /**
442
+ * Creates the panel element with header and content areas.
443
+ * Panel is positioned as a dropdown below the toggle button.
444
+ *
445
+ * @returns The panel element
446
+ */
447
+ private _createPanel;
448
+ /**
449
+ * Setup event listeners for panel positioning and click-outside behavior.
450
+ */
451
+ private _setupEventListeners;
452
+ /**
453
+ * Detect which corner the control is positioned in.
454
+ *
455
+ * @returns The position: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right'
456
+ */
457
+ private _getControlPosition;
458
+ /**
459
+ * Update the panel position based on button location and control corner.
460
+ * Positions the panel next to the button, expanding in the appropriate direction.
461
+ */
462
+ private _updatePanelPosition;
463
+ }
464
+
465
+ /**
466
+ * Event types emitted by the raster control
467
+ */
468
+ export declare type RasterControlEvent = 'collapse' | 'expand' | 'statechange' | 'rasteradd' | 'rasterremove' | 'rasterchange' | 'rasterselect' | 'error';
469
+
470
+ /**
471
+ * Event payload passed to registered handlers.
472
+ */
473
+ export declare interface RasterControlEventData {
474
+ type: RasterControlEvent;
475
+ state: RasterControlState;
476
+ /** Affected layer id for raster* events. */
477
+ layerId?: string;
478
+ /** Error detail for 'error' events. */
479
+ error?: Error;
480
+ }
481
+
482
+ /**
483
+ * Event handler function type
484
+ */
485
+ export declare type RasterControlEventHandler = (event: RasterControlEventData) => void;
486
+
487
+ /**
488
+ * Options for configuring the RasterControl
489
+ */
490
+ export declare interface RasterControlOptions {
491
+ /**
492
+ * Whether the control panel should start collapsed (showing only the toggle button)
493
+ * @default true
494
+ */
495
+ collapsed?: boolean;
496
+ /**
497
+ * Position of the control on the map
498
+ * @default 'top-right'
499
+ */
500
+ position?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
501
+ /**
502
+ * Title displayed in the control header
503
+ * @default 'Raster'
504
+ */
505
+ title?: string;
506
+ /**
507
+ * Width of the control panel in pixels
508
+ * @default 360
509
+ */
510
+ panelWidth?: number;
511
+ /**
512
+ * Custom CSS class name for the control container
513
+ */
514
+ className?: string;
515
+ /**
516
+ * Render the deck.gl overlay interleaved with the basemap's layers.
517
+ * @default true
518
+ */
519
+ interleaved?: boolean;
520
+ /**
521
+ * Prefills the "Add data" URL input with this COG URL. The raster is only
522
+ * loaded automatically when {@link autoLoad} is true; otherwise the user
523
+ * still clicks Load.
524
+ * @default ''
525
+ */
526
+ defaultUrl?: string;
527
+ /**
528
+ * When true and {@link defaultUrl} is set, the raster is loaded as soon as
529
+ * the control is added to the map (instead of prefilling the URL input).
530
+ * @default false
531
+ */
532
+ autoLoad?: boolean;
533
+ }
534
+
535
+ /**
536
+ * Internal state of the plugin control
537
+ */
538
+ export declare interface RasterControlState {
539
+ /**
540
+ * Whether the control panel is currently collapsed
541
+ */
542
+ collapsed: boolean;
543
+ /**
544
+ * Current panel width in pixels
545
+ */
546
+ panelWidth: number;
547
+ /**
548
+ * Any custom state data
549
+ */
550
+ data?: Record<string, unknown>;
551
+ }
552
+
553
+ /**
554
+ * Public, read-only snapshot of a raster layer.
555
+ */
556
+ export declare interface RasterLayerInfo {
557
+ /** Stable layer id. */
558
+ id: string;
559
+ /** Display name shown in the layer list. */
560
+ name: string;
561
+ /** Data source. */
562
+ source: RasterLayerSource;
563
+ /** Band count, known once the GeoTIFF header loads. */
564
+ bandCount: number | null;
565
+ /** 1-indexed band names parsed from GDAL_METADATA, when present. */
566
+ bandNames: globalThis.Map<number, string> | null;
567
+ /** Map style layer id the raster is inserted beneath, when set. */
568
+ beforeId: string | null;
569
+ /** Current visualization state. */
570
+ state: RasterLayerState;
571
+ }
572
+
573
+ /** Where a raster layer's data came from. */
574
+ export declare type RasterLayerSource = {
575
+ kind: 'url';
576
+ url: string;
577
+ } | {
578
+ kind: 'file';
579
+ fileName: string;
580
+ objectUrl: string;
581
+ };
582
+
583
+ /**
584
+ * Per-layer visualization state.
585
+ */
586
+ export declare interface RasterLayerState {
587
+ /** Rendering mode. */
588
+ mode: RasterMode;
589
+ /** 1-indexed band selection: [r, g, b] in RGB mode, [band] in single mode. */
590
+ bands: number[];
591
+ /** Per-channel [min, max] rescale windows; null = auto (2-98% percentile
592
+ * from computed stats). */
593
+ rescale: [number, number][] | null;
594
+ /** Colormap name (single-band mode only). 'palette' uses the image's
595
+ * embedded color table; defaults to 'gray'. */
596
+ colormap: string;
597
+ /** Nodata handling. */
598
+ nodata: RasterNodata;
599
+ /** Layer transparency, 0 (invisible) to 1 (fully opaque). */
600
+ opacity: number;
601
+ /** Power-law gamma correction (1.0 = off). */
602
+ gamma: number;
603
+ /** Curve applied to rescaled values. */
604
+ stretch: RasterStretch;
605
+ /** Whether the layer is drawn on the map. */
606
+ visible: boolean;
607
+ }
608
+
609
+ /** Rendering mode: RGB composite (one band per channel) or single band
610
+ * through a colormap. */
611
+ export declare type RasterMode = 'rgb' | 'single';
612
+
613
+ /** Nodata handling: 'auto' reads the value declared by the COG (and treats
614
+ * NaN as nodata for float data), a number overrides it in source units, and
615
+ * 'off' renders every pixel. */
616
+ export declare type RasterNodata = number | 'off' | 'auto';
617
+
618
+ /** Curve applied to the rescaled [0, 1] value before gamma / colormap.
619
+ * "log" expands the low-value range (useful for skewed data with most
620
+ * variation near zero); "sqrt" is a gentler version. */
621
+ export declare type RasterStretch = 'linear' | 'log' | 'sqrt';
622
+
623
+ /**
624
+ * Parse band descriptions from the GDAL_METADATA XML tag. Looks for
625
+ * `<Item name="DESCRIPTION" sample="N">name</Item>` (and a few common
626
+ * aliases) and returns a 1-indexed band → name map. The geotiff package
627
+ * surfaces statistics from this XML but not descriptions, so we re-parse.
628
+ */
629
+ export declare function readBandNames(tiff: GeoTIFF): Map<number, string> | null;
630
+
631
+ /** Pure derivation from an already-loaded GeoTIFF: no fetches, no I/O. */
632
+ export declare function summarizeGeoTIFF(tiff: MetadataInput): MetadataSummary;
633
+
634
+ /**
635
+ * Throttles a function call.
636
+ *
637
+ * @param fn - The function to throttle
638
+ * @param limit - The minimum time between calls in milliseconds
639
+ * @returns A throttled version of the function
640
+ *
641
+ * @example
642
+ * ```typescript
643
+ * const throttledScroll = throttle(() => handleScroll(), 100);
644
+ * window.addEventListener('scroll', throttledScroll);
645
+ * ```
646
+ */
647
+ export declare function throttle<T extends (...args: unknown[]) => void>(fn: T, limit: number): (...args: Parameters<T>) => void;
648
+
649
+ export { }