@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.
package/dist/zarr.d.ts ADDED
@@ -0,0 +1,87 @@
1
+ /**
2
+ * GeoZarr / Zarr raster layer (spec: issue — "Zarr format layers"). A LAZY
3
+ * chunk — dynamically imported the first time a manifest uses
4
+ * `type="ZarrLayer"` (the layer-registry `loadClass` seam), so the eager bundle
5
+ * carries none of zarrita / deck.gl-zarr. Built on
6
+ * `@developmentseed/deck.gl-zarr` (`ZarrLayer`) + `zarrita`, at the same 0.7.0
7
+ * as the COG stack, and it REUSES the shared raster GPU pipeline
8
+ * (raster-pipeline.ts) — colormap / rescale / nodata — that COGLayer uses.
9
+ *
10
+ * GeoZarr is chunked N-dimensional arrays. Two things differ from a COG:
11
+ * 1. The store is opened by US (zarrita FetchStore), not the layer — so this
12
+ * is a CompositeLayer that opens the store async and renders a child
13
+ * ZarrLayer once the variable array resolves.
14
+ * 2. It's N-dimensional: the author picks a `variable` and pins every
15
+ * non-spatial dimension via `select="time=0, level=3"`.
16
+ *
17
+ * Georeferencing: a GeoZarr-compliant store carries the spatial/geo-proj
18
+ * conventions and is used as-is. A plain (non-GeoZarr) store — common for
19
+ * real-world public Zarr, e.g. the ECMWF forecast archive — is georeferenced
20
+ * from author-supplied `bounds` + `crs` + `spatial-dims`, which we assemble
21
+ * into the same synthetic attrs `ZarrLayer`'s `metadata` prop accepts.
22
+ */
23
+ import { CompositeLayer, type Layer, type LayersList } from "@deck.gl/core";
24
+ import * as zarr from "zarrita";
25
+ import { type RasterStyle } from "./raster-pipeline";
26
+ type AnyProps = Record<string, unknown>;
27
+ /** `select="time=0, level=3"` (or JSON) → the zarrita selection: one pinned index per non-spatial dim. */
28
+ export declare function parseZarrSelection(raw: string | undefined): Record<string, number>;
29
+ /**
30
+ * Build the synthetic GeoZarr attrs a NON-GeoZarr store needs, from the author's
31
+ * `bounds` + `crs` + `spatial-dims` and the array's own spatial shape (the last
32
+ * two dims). The affine follows @developmentseed/affine's `[a,b,c,d,e,f]` form:
33
+ * `x = a*col + b*row + c`, `y = d*col + e*row + f` — top-left origin.
34
+ */
35
+ export declare function buildManualGeoZarrAttrs(bounds: [number, number, number, number], crs: string, spatialDims: [string, string], spatialShape: [number, number]): Record<string, unknown>;
36
+ export interface OmZarrLayerProps extends RasterStyle {
37
+ /** The Zarr store URL (a `.zarr` group). */
38
+ src?: string;
39
+ /** Path to the variable array within the store. */
40
+ variable?: string;
41
+ /** Non-spatial dimension pins, `"time=0, level=3"`. Every non-spatial dim must be pinned. */
42
+ select?: string;
43
+ /** Manual georeferencing for a non-GeoZarr store — `[west, south, east, north]`. */
44
+ bounds?: [number, number, number, number];
45
+ /** CRS for manual georeferencing, e.g. `"EPSG:4326"`. Required with `bounds`. */
46
+ crs?: string;
47
+ /** The two spatial dimension names for manual georeferencing, e.g. `"latitude longitude"`. */
48
+ spatialDims?: string;
49
+ }
50
+ interface ZarrState {
51
+ status: "loading" | "ready" | "error";
52
+ node?: zarr.Array<zarr.NumberDataType, zarr.Readable> | zarr.Group<zarr.Readable>;
53
+ variable?: string;
54
+ metadata?: Record<string, unknown>;
55
+ selection: Record<string, number>;
56
+ loadKey: string;
57
+ /** deck's CompositeLayer state carries an index signature; mirror it so the override type-checks. */
58
+ [key: string]: unknown;
59
+ }
60
+ /**
61
+ * The manifest-facing class behind `<om-layer type="ZarrLayer">`. Opens the
62
+ * zarrita store, resolves the variable, and renders a child ZarrLayer with our
63
+ * colormap pipeline. Restretch/recolor (min/max/colormap/nodata) never reopen
64
+ * the store — they only rebuild the per-frame render pipeline.
65
+ */
66
+ export declare class OmZarrLayer extends CompositeLayer<OmZarrLayerProps & AnyProps> {
67
+ static layerName: string;
68
+ static defaultProps: {
69
+ src: string;
70
+ variable: string;
71
+ select: string;
72
+ rescaleMin: null;
73
+ rescaleMax: null;
74
+ colormap: null;
75
+ nodataOverride: null;
76
+ };
77
+ state: ZarrState;
78
+ initializeState(): void;
79
+ updateState({ changeFlags }: {
80
+ changeFlags: {
81
+ propsChanged: boolean | string;
82
+ };
83
+ }): void;
84
+ private _load;
85
+ renderLayers(): LayersList | Layer | null;
86
+ }
87
+ export {};