maplibre-gl-raster 0.2.0 → 0.2.2

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.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { _ as colormaps_default, a as debounce, c as throttle, d as percentileFromHistogram, f as readBandNames, g as COLORMAP_ROW_COUNT, h as COLORMAP_OPTIONS, i as classNames, l as MAX_SAMPLE_TILES, m as COLORMAP_NAMES, n as PALETTE_COLORMAP, o as formatNumericValue, p as loadGeoTIFF, r as clamp, s as generateId, t as RasterControl, u as computeAutoStats } from "./RasterControl-Dsq7VIl7.js";
1
+ import { _ as colormaps_default, a as debounce, c as throttle, d as percentileFromHistogram, f as readBandNames, g as COLORMAP_ROW_COUNT, h as COLORMAP_OPTIONS, i as classNames, l as MAX_SAMPLE_TILES, m as COLORMAP_NAMES, n as PALETTE_COLORMAP, o as formatNumericValue, p as loadGeoTIFF, r as clamp, s as generateId, t as RasterControl, u as computeAutoStats, v as createResilientEpsgResolver } from "./RasterControl-BxGg08KC.js";
2
2
  import { a as Photometric, d as TiffTag, i as Compression, l as SampleFormat, o as PlanarConfiguration, s as Predictor } from "./decode-BL-qbDOV.js";
3
3
  //#region src/lib/raster/metadata.ts
4
4
  var SAMPLE_FORMAT_LABELS = {
@@ -218,6 +218,6 @@ function summarizeGeoTIFF(tiff) {
218
218
  };
219
219
  }
220
220
  //#endregion
221
- export { COLORMAP_NAMES, COLORMAP_OPTIONS, COLORMAP_ROW_COUNT, MAX_SAMPLE_TILES, PALETTE_COLORMAP, RasterControl, clamp, classNames, colormaps_default as colormapsPngUrl, computeAutoStats, debounce, formatNumericValue, generateId, loadGeoTIFF, percentileFromHistogram, readBandNames, summarizeGeoTIFF, throttle };
221
+ export { COLORMAP_NAMES, COLORMAP_OPTIONS, COLORMAP_ROW_COUNT, MAX_SAMPLE_TILES, PALETTE_COLORMAP, RasterControl, clamp, classNames, colormaps_default as colormapsPngUrl, computeAutoStats, createResilientEpsgResolver, debounce, formatNumericValue, generateId, loadGeoTIFF, percentileFromHistogram, readBandNames, summarizeGeoTIFF, throttle };
222
222
 
223
223
  //# sourceMappingURL=index.mjs.map
package/dist/react.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { t as RasterControl } from "./RasterControl-Dsq7VIl7.js";
1
+ import { t as RasterControl } from "./RasterControl-BxGg08KC.js";
2
2
  import { useCallback, useEffect, useRef, useState } from "react";
3
3
  //#region src/lib/core/RasterControlReact.tsx
4
4
  /**
@@ -1,4 +1,5 @@
1
1
  import { default as colormapsPngUrl } from '@developmentseed/deck.gl-raster/gpu-modules/colormaps.png';
2
+ import { EpsgResolver } from '@developmentseed/proj';
2
3
  import { GeoTIFF } from '@developmentseed/geotiff';
3
4
  import { IControl } from 'maplibre-gl';
4
5
  import { Map as Map_2 } from 'maplibre-gl';
@@ -125,6 +126,16 @@ export { colormapsPngUrl }
125
126
  * Promise. Caller guards against stale results. */
126
127
  export declare function computeAutoStats(tiff: GeoTIFF, signal: AbortSignal, onProgress?: (partial: AutoStats) => void): Promise<AutoStats>;
127
128
 
129
+ /**
130
+ * Builds an {@link EpsgResolver} that resolves common CRS offline, delegates
131
+ * the rest to {@link ResilientEpsgResolverOptions.fallback} (epsg.io by
132
+ * default), and rethrows failures with a clear, actionable message.
133
+ *
134
+ * @param options - Optional fallback resolver override.
135
+ * @returns A resolver suitable for the COGLayer `epsgResolver` prop.
136
+ */
137
+ export declare function createResilientEpsgResolver(options?: ResilientEpsgResolverOptions): EpsgResolver;
138
+
128
139
  export declare type CrsSummary = {
129
140
  /** EPSG code when the COG declares one; null for user-defined CRSes. */
130
141
  code: number | null;
@@ -153,6 +164,8 @@ export declare type CrsSummary = {
153
164
  */
154
165
  export declare function debounce<T extends (...args: unknown[]) => void>(fn: T, delay: number): (...args: Parameters<T>) => void;
155
166
 
167
+ export { EpsgResolver }
168
+
156
169
  /**
157
170
  * Formats a numeric value with appropriate decimal places based on step size.
158
171
  *
@@ -539,6 +552,14 @@ export declare interface RasterControlOptions {
539
552
  * @default false
540
553
  */
541
554
  autoLoad?: boolean;
555
+ /**
556
+ * Resolves a GeoTIFF's numeric EPSG code to a projection definition used for
557
+ * reprojection. Defaults to {@link createResilientEpsgResolver}, which
558
+ * answers common CRS offline and looks the rest up from epsg.io. Supply a
559
+ * fully offline resolver (e.g. backed by a local EPSG database) to remove the
560
+ * network dependency entirely. Resolution failures surface as a layer error.
561
+ */
562
+ epsgResolver?: EpsgResolver;
542
563
  }
543
564
 
544
565
  /**
@@ -644,6 +665,16 @@ export declare type RasterStretch = 'linear' | 'log' | 'sqrt';
644
665
  */
645
666
  export declare function readBandNames(tiff: GeoTIFF): Map<number, string> | null;
646
667
 
668
+ export declare interface ResilientEpsgResolverOptions {
669
+ /**
670
+ * Resolver used for EPSG codes without a built-in offline definition.
671
+ * Defaults to the upstream epsg.io-backed resolver. Supply a fully offline
672
+ * resolver (e.g. one backed by a local EPSG database) to remove the network
673
+ * dependency entirely.
674
+ */
675
+ fallback?: EpsgResolver;
676
+ }
677
+
647
678
  /** Pure derivation from an already-loaded GeoTIFF: no fetches, no I/O. */
648
679
  export declare function summarizeGeoTIFF(tiff: MetadataInput): MetadataSummary;
649
680
 
@@ -1,4 +1,5 @@
1
1
  import { Dispatch } from 'react';
2
+ import { EpsgResolver } from '@developmentseed/proj';
2
3
  import { IControl } from 'maplibre-gl';
3
4
  import { Map as Map_2 } from 'maplibre-gl';
4
5
  import { SetStateAction } from 'react';
@@ -302,6 +303,14 @@ export declare interface RasterControlOptions {
302
303
  * @default false
303
304
  */
304
305
  autoLoad?: boolean;
306
+ /**
307
+ * Resolves a GeoTIFF's numeric EPSG code to a projection definition used for
308
+ * reprojection. Defaults to {@link createResilientEpsgResolver}, which
309
+ * answers common CRS offline and looks the rest up from epsg.io. Supply a
310
+ * fully offline resolver (e.g. backed by a local EPSG database) to remove the
311
+ * network dependency entirely. Resolution failures surface as a layer error.
312
+ */
313
+ epsgResolver?: EpsgResolver;
305
314
  }
306
315
 
307
316
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maplibre-gl-raster",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A MapLibre GL JS plugin for visualizing local and remote raster datasets (GeoTIFF/COG)",
5
5
  "type": "module",
6
6
  "main": "./dist/index.mjs",