@nika-js/onlymap 0.5.9 → 0.5.11

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.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Shared raster GPU styling pipeline — used by BOTH the COG layer (raster.ts)
3
+ * and the Zarr layer (zarr.ts). Depends only on `@developmentseed/deck.gl-raster`
4
+ * (the GPU modules), NOT on `@developmentseed/deck.gl-geotiff` or `zarrita`, so
5
+ * neither lazy chunk drags the other's decoder in.
6
+ *
7
+ * The contract: a per-tile Float32 texture (single-band `r32float`, or three-
8
+ * band `rgba32float`) plus the styling scalars, run through
9
+ * FilterNoDataVal → LinearRescale → Colormap (single-band only). Restretch and
10
+ * recolor are uniform-only updates on a fresh layer instance; the tile cache
11
+ * survives because the getTileData callback that produced these textures is a
12
+ * module-level stable reference in each layer.
13
+ */
14
+ import type { Device, Texture } from "@luma.gl/core";
15
+ import { type RasterModule } from "@developmentseed/deck.gl-raster/gpu-modules";
16
+ /** A styled tile's GPU payload (satisfies deck.gl-raster's MinimalTileData + ours). */
17
+ export interface OmTileData {
18
+ width: number;
19
+ height: number;
20
+ byteLength: number;
21
+ texture: Texture;
22
+ colormapTexture: Texture;
23
+ bandCount: number;
24
+ nodata: number | null;
25
+ }
26
+ /** The four styling scalars every raster source (COG, Zarr) exposes. */
27
+ export interface RasterStyle {
28
+ /** Rescale window; both default to the 8-bit range when absent. */
29
+ rescaleMin?: number | null;
30
+ rescaleMax?: number | null;
31
+ /** Sprite colormap name (single-band sources only). Unknown names warn + fall back to gray. */
32
+ colormap?: string | null;
33
+ /** Overrides the source's own nodata sentinel. */
34
+ nodataOverride?: number | null;
35
+ }
36
+ export declare function getColormapTexture(device: Device): Promise<Texture>;
37
+ export declare function resolveColormapIndex(name: string): number;
38
+ /**
39
+ * The styled render pipeline for one tile. Nodata tests the RAW datum, so it
40
+ * precedes the rescale squash; the colormap runs only for single-band sources.
41
+ */
42
+ export declare function buildRenderPipeline(tile: OmTileData, style: RasterStyle): {
43
+ renderPipeline: RasterModule[];
44
+ };
package/dist/raster.d.ts CHANGED
@@ -1,46 +1,7 @@
1
- /**
2
- * Native COG/GeoTIFF raster layer (spec: "Raster / GeoTIFF — native COG
3
- * layer"). A LAZY chunk — dynamically imported the first time a manifest
4
- * uses `type="COGLayer"` (see layer-registry's `loadClass` seam), so the
5
- * eager bundle stays raster-free.
6
- *
7
- * Built on `@developmentseed/deck.gl-geotiff` + `deck.gl-raster` (MIT),
8
- * compiled INSIDE the library so their `@deck.gl/*` imports resolve to the
9
- * bundled deck — the class-identity requirement that rules out consuming
10
- * these packages from a consumer's own node_modules.
11
- *
12
- * Two render paths, chosen per instance:
13
- * - UNSTYLED (no min/max/colormap/nodata authored): COGLayer's own inferred
14
- * default pipeline — correct for plain 8-bit RGB/gray COGs, zero config.
15
- * - STYLED: a Float32-aware getTileData/renderTile pair (ported from a
16
- * production consumer): tile pixels upload as r32float / rgba32float
17
- * textures, then FilterNoDataVal (raw values, BEFORE rescale) →
18
- * LinearRescale (min/max → [0,1]) → Colormap (single-band only, sampled
19
- * from the bundled sprite). Restretch/recolor = uniform updates on a new
20
- * layer instance; the tile cache survives because `getTileData` is a
21
- * module-level stable reference.
22
- */
23
- import type { Texture } from "@luma.gl/core";
24
1
  import { COGLayer } from "@developmentseed/deck.gl-geotiff";
25
- /** The styled path's per-tile payload (satisfies MinimalTileData + ours). */
26
- type OmTileData = {
27
- width: number;
28
- height: number;
29
- byteLength: number;
30
- texture: Texture;
31
- colormapTexture: Texture;
32
- bandCount: number;
33
- nodata: number | null;
34
- };
35
- export interface OmCOGLayerExtraProps {
36
- /** Rescale window; both default to the 8-bit range when absent. */
37
- rescaleMin?: number | null;
38
- rescaleMax?: number | null;
39
- /** Sprite colormap name (single-band sources only). Unknown names warn + fall back to gray. */
40
- colormap?: string | null;
41
- /** Overrides the source's own nodata sentinel. */
42
- nodataOverride?: number | null;
43
- }
2
+ import { type OmTileData, type RasterStyle } from "./raster-pipeline";
3
+ /** COGLayer styling scalars (rescale window, colormap, nodata). Shared with the Zarr layer; re-exported for consumer wrappers. */
4
+ export type OmCOGLayerExtraProps = RasterStyle;
44
5
  type AnyProps = Record<string, unknown>;
45
6
  declare const OmCOGLayer_base: new (...props: AnyProps[]) => InstanceType<typeof COGLayer>;
46
7
  /**
package/dist/version.d.ts CHANGED
@@ -5,4 +5,4 @@
5
5
  * the build rootDir, and a `define` would need repeating across vite/vitest/
6
6
  * vite-node configs.
7
7
  */
8
- export declare const LIBRARY_VERSION = "0.5.9";
8
+ export declare const LIBRARY_VERSION = "0.5.11";