ol-stac 1.5.1 → 1.7.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.
- package/README.md +2 -1
- package/http.d.ts +35 -0
- package/http.d.ts.map +1 -0
- package/http.js +101 -0
- package/http.js.map +1 -0
- package/layer/STAC.d.ts +245 -23
- package/layer/STAC.d.ts.map +1 -1
- package/layer/STAC.js +428 -104
- package/layer/STAC.js.map +1 -1
- package/layer/type.d.ts +88 -0
- package/layer/type.d.ts.map +1 -0
- package/layer/type.js +83 -0
- package/layer/type.js.map +1 -0
- package/package.json +3 -2
- package/proj.d.ts +2 -2
- package/proj.d.ts.map +1 -1
- package/proj.js +51 -5
- package/proj.js.map +1 -1
- package/shim/ogcTileUtil.d.ts +11 -0
- package/shim/ogcTileUtil.d.ts.map +1 -0
- package/shim/ogcTileUtil.js +20 -0
- package/shim/ogcTileUtil.js.map +1 -0
- package/shim/proj4.d.ts +9 -0
- package/shim/proj4.d.ts.map +1 -0
- package/shim/proj4.js +28 -0
- package/shim/proj4.js.map +1 -0
- package/source/GeoZarr.d.ts +578 -0
- package/source/GeoZarr.d.ts.map +1 -0
- package/source/GeoZarr.js +1930 -0
- package/source/GeoZarr.js.map +1 -0
- package/source/type.d.ts +20 -3
- package/source/type.d.ts.map +1 -1
- package/source/type.js +19 -2
- package/source/type.js.map +1 -1
- package/util.d.ts +149 -9
- package/util.d.ts.map +1 -1
- package/util.js +852 -44
- package/util.js.map +1 -1
|
@@ -0,0 +1,578 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @typedef {'nearest'|'linear'} ResampleMethod
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {Object} Band
|
|
6
|
+
* @property {string} name The band name.
|
|
7
|
+
* @property {string} group The group path relative to the `url`, containing this band
|
|
8
|
+
* (e.g. `'measurements/reflectance'`).
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef {Object} GeoZarrStoreOptions
|
|
12
|
+
* @property {Object<string, string>} [headers] additional key-value pairs of headers to be passed with each request. Key is the header name, value the header value.
|
|
13
|
+
* @property {string} [credentials] How credentials shall be handled. See
|
|
14
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/fetch for reference and possible values
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* @typedef {Object} Options
|
|
18
|
+
* @property {string} url When `bands` contains plain strings, this must be the full URL to the
|
|
19
|
+
* multiscales group (e.g. `'https://example.com/store.zarr/measurements/reflectance'`).
|
|
20
|
+
* When `bands` contains {@link Band} objects, this is the base URL from which each band's
|
|
21
|
+
* `group` path is resolved (e.g. `'https://example.com/store.zarr/satellite/sentinel2'`).
|
|
22
|
+
* @property {Array<string|Band>} [bands] The bands to render, for stores where each
|
|
23
|
+
* band is a separate array. Mutually exclusive with `variable`. Each entry is either a band name
|
|
24
|
+
* string (single-group mode) or a {@link Band} object specifying both the band name and the
|
|
25
|
+
* group it belongs to (multi-group mode). In multi-group mode, the first band's group
|
|
26
|
+
* determines the tile grid and must follow at least the proj: and spatial: conventions.
|
|
27
|
+
* If it also has a multiscales layout (all three conventions), multiple resolution levels are
|
|
28
|
+
* supported. Otherwise a single-resolution tile grid is derived from `spatial:bbox`,
|
|
29
|
+
* `proj:code`, and `spatial:shape` (or the array shape from consolidated metadata).
|
|
30
|
+
* Bands from additional groups do not need to follow any convention; they can be multi-scale
|
|
31
|
+
* (array located at `<matrixId>/<bandName>`) or single-scale (array at the group root).
|
|
32
|
+
* @property {GeoZarrStoreOptions} [storeOptions] Additional options to be passed to
|
|
33
|
+
* [zarrita](https://zarrita.dev/)'s `FetchStore` with each request to the Zarr store.
|
|
34
|
+
* @property {import("ol/proj.js").ProjectionLike} [projection] Source projection.
|
|
35
|
+
* If not provided, the GeoZarr metadata will be read for projection information.
|
|
36
|
+
* @property {number} [transition=250] Duration of the opacity transition for rendering.
|
|
37
|
+
* To disable the opacity transition, pass `transition: 0`.
|
|
38
|
+
* @property {boolean} [wrapX=false] Render tiles beyond the tile grid extent.
|
|
39
|
+
* @property {ResampleMethod} [resample='linear'] Resampling method if bands are not available for all multi-scale levels.
|
|
40
|
+
* @property {Object<string, number|string|Array<number|string>>} [dimensions] How to slice
|
|
41
|
+
* each non-spatial dimension of the band arrays, keyed by dimension name (e.g. `{time: 0}` for
|
|
42
|
+
* the first time step of a `[time, y, x]` cube). Values are 0-based indices (number) or
|
|
43
|
+
* coordinate labels (string); unlisted dimensions default to index 0. Names come from each
|
|
44
|
+
* array's `dimension_names`, or are the axis position as a string when it has none; use the
|
|
45
|
+
* names from {@link getDimensions}. Labels are resolved against the dimension's coordinate
|
|
46
|
+
* array; if that array cannot be read, pass indices instead. With `variable`, at most one
|
|
47
|
+
* dimension may map to an array of values, whose entries are rendered as separate bands in
|
|
48
|
+
* the given order. Change the selection on the fly with
|
|
49
|
+
* {@link module:ol/source/GeoZarr~GeoZarr#updateDimensions}.
|
|
50
|
+
* @property {string} [variable] The name of an n-dimensional data array (variable) to
|
|
51
|
+
* render, for stores where all bands are packed into a single array (e.g. a
|
|
52
|
+
* `(time, band, y, x)` datacube). The array must exist within each multiscale level
|
|
53
|
+
* group (or at the group root for single-scale stores). Mutually exclusive with `bands`,
|
|
54
|
+
* and required to select several bands from one dimension through `dimensions`.
|
|
55
|
+
* @property {import("ol/extent.js").Extent} [extent] Fallback extent of the data, in
|
|
56
|
+
* coordinates of the source projection. Only used when the store neither declares its
|
|
57
|
+
* extent (`spatial:bbox` or `bounds` attributes) nor has coordinate arrays to infer it.
|
|
58
|
+
* @property {boolean} [flipY] Fallback orientation: set to `true` when the data is
|
|
59
|
+
* stored south-up (ascending y). Only used when the orientation can neither be read
|
|
60
|
+
* from the store metadata nor inferred from its coordinate arrays.
|
|
61
|
+
*/
|
|
62
|
+
/**
|
|
63
|
+
* Source for GeoZarr stores conforming to the following conventions:
|
|
64
|
+
* - [Zarr multiscales convention](https://github.com/zarr-conventions/multiscales)
|
|
65
|
+
* - [Geospatial projection convention](https://github.com/zarr-conventions/geo-proj)
|
|
66
|
+
* - [Spatial convention](https://github.com/zarr-conventions/spatial)
|
|
67
|
+
*
|
|
68
|
+
* The store is read as a stack of resolution levels, enumerated from the
|
|
69
|
+
* `multiscales` attribute in either its `{layout: [{asset, ...}]}` or its
|
|
70
|
+
* `[{datasets: [{path, ...}]}]` form; a store with neither has the group itself as
|
|
71
|
+
* its only level. The legacy `tile_matrix_set` attribute is also supported, and
|
|
72
|
+
* describes the levels itself.
|
|
73
|
+
*
|
|
74
|
+
* Extent, resolution, projection and y-axis orientation are read from the store
|
|
75
|
+
* metadata (`spatial:bbox`, `spatial:shape`, `spatial:transform`, `proj:code`,
|
|
76
|
+
* ...) where declared, and otherwise inferred from the coordinate arrays. The
|
|
77
|
+
* conventions above are what make that metadata available, but none of them has
|
|
78
|
+
* to be declared for a store that provides the attributes.
|
|
79
|
+
*
|
|
80
|
+
* Two data layouts are supported:
|
|
81
|
+
* - One array per band (`bands` option), addressed by name at `<matrixId>/<bandName>`
|
|
82
|
+
* (multi-scale) or at the group root (single-scale).
|
|
83
|
+
* - A single n-dimensional data array shared by all bands (`variable` + `dimensions`
|
|
84
|
+
* options), e.g. a `(time, band, y, x)` datacube.
|
|
85
|
+
*
|
|
86
|
+
* Both layouts support Zarr v2 and v3.
|
|
87
|
+
*/
|
|
88
|
+
export default class GeoZarr extends DataTileSource<import("ol/DataTile.js").default> {
|
|
89
|
+
/**
|
|
90
|
+
* @param {Options} options The options.
|
|
91
|
+
*/
|
|
92
|
+
constructor(options: Options);
|
|
93
|
+
/**
|
|
94
|
+
* @type {string}
|
|
95
|
+
* @private
|
|
96
|
+
*/
|
|
97
|
+
private url_;
|
|
98
|
+
/**
|
|
99
|
+
* @type {GeoZarrStoreOptions|undefined}
|
|
100
|
+
* @private
|
|
101
|
+
*/
|
|
102
|
+
private storeOptions_;
|
|
103
|
+
/**
|
|
104
|
+
* Selection per non-spatial dimension name, from the `dimensions` option.
|
|
105
|
+
* Coordinate labels are replaced by their index once resolved.
|
|
106
|
+
* @type {Object<string, number|string|Array<number|string>>}
|
|
107
|
+
* @private
|
|
108
|
+
*/
|
|
109
|
+
private dimensions_;
|
|
110
|
+
/**
|
|
111
|
+
* @type {string|undefined}
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
private variable_;
|
|
115
|
+
/**
|
|
116
|
+
* @type {import("ol/extent.js").Extent|undefined}
|
|
117
|
+
* @private
|
|
118
|
+
*/
|
|
119
|
+
private fallbackExtent_;
|
|
120
|
+
/**
|
|
121
|
+
* @type {boolean|undefined}
|
|
122
|
+
* @private
|
|
123
|
+
*/
|
|
124
|
+
private fallbackFlipY_;
|
|
125
|
+
/**
|
|
126
|
+
* The zarrita open function, pinned to the store's Zarr version by
|
|
127
|
+
* `configure_`. Never the unpinned `open`, which probes v2 metadata first
|
|
128
|
+
* and so requests keys that a v3 store does not have.
|
|
129
|
+
* @type {Function}
|
|
130
|
+
* @private
|
|
131
|
+
*/
|
|
132
|
+
private openFn_;
|
|
133
|
+
/**
|
|
134
|
+
* Group path prefix per tile matrix id, for stores whose levels are not
|
|
135
|
+
* addressed by the matrix id itself (empty string for the group root).
|
|
136
|
+
* `null` when the matrix id is the prefix.
|
|
137
|
+
* @type {Object<string, string>|null}
|
|
138
|
+
* @private
|
|
139
|
+
*/
|
|
140
|
+
private levelPaths_;
|
|
141
|
+
/**
|
|
142
|
+
* Row axis information per tile matrix id, for data with non-square
|
|
143
|
+
* pixels or south-up (flipped) rows.
|
|
144
|
+
* @type {Object<string, {rowResolution: number, shapeY: number|undefined, flip: boolean}>|null}
|
|
145
|
+
* @private
|
|
146
|
+
*/
|
|
147
|
+
private levelRowInfo_;
|
|
148
|
+
/**
|
|
149
|
+
* The axis selected as multiple bands through the `dimensions` option,
|
|
150
|
+
* or -1.
|
|
151
|
+
* @type {number}
|
|
152
|
+
* @private
|
|
153
|
+
*/
|
|
154
|
+
private multiAxis_;
|
|
155
|
+
/**
|
|
156
|
+
* @type {Error|null}
|
|
157
|
+
*/
|
|
158
|
+
error_: Error | null;
|
|
159
|
+
/**
|
|
160
|
+
* @type {Array<import('zarrita').Group<any>>}
|
|
161
|
+
* @private
|
|
162
|
+
*/
|
|
163
|
+
private groups_;
|
|
164
|
+
/**
|
|
165
|
+
* @type {Object<string, *>|null}
|
|
166
|
+
* @private
|
|
167
|
+
*/
|
|
168
|
+
private consolidatedMetadata_;
|
|
169
|
+
/**
|
|
170
|
+
* Cache of opened zarrita arrays keyed by path. Caching the Promise
|
|
171
|
+
* (not the resolved value) deduplicates concurrent opens for the same
|
|
172
|
+
* array path across tiles at the same zoom level.
|
|
173
|
+
* @private
|
|
174
|
+
* @type {Map<string, Promise<import('zarrita').Array<import('zarrita').DataType, any>>>}
|
|
175
|
+
*/
|
|
176
|
+
private arrayCache_;
|
|
177
|
+
/**
|
|
178
|
+
* @type {Array<string>|undefined}
|
|
179
|
+
* @private
|
|
180
|
+
*/
|
|
181
|
+
private groupPaths_;
|
|
182
|
+
/**
|
|
183
|
+
* Maps each band index to the index of the group it belongs to in `this.groups_`.
|
|
184
|
+
* @type {Array<number>}
|
|
185
|
+
* @private
|
|
186
|
+
*/
|
|
187
|
+
private bandGroupIndex_;
|
|
188
|
+
/**
|
|
189
|
+
* Pixel resolution for single-scale bands. When set, indicates that the
|
|
190
|
+
* band lives directly at its group root (no matrixId subdirectory) and
|
|
191
|
+
* provides the pixel resolution to use for coordinate calculations.
|
|
192
|
+
* Undefined for multi-scale bands.
|
|
193
|
+
* @type {Array<number|undefined>}
|
|
194
|
+
* @private
|
|
195
|
+
*/
|
|
196
|
+
private bandSingleScaleResolution_;
|
|
197
|
+
/**
|
|
198
|
+
* @type {Array<string>}
|
|
199
|
+
* @private
|
|
200
|
+
*/
|
|
201
|
+
private bands_;
|
|
202
|
+
/**
|
|
203
|
+
* Per-band selection along non-spatial dimensions: `undefined` for 2-D
|
|
204
|
+
* arrays, otherwise an array aligned to the array rank with a fixed integer
|
|
205
|
+
* at each extra axis and `null` at the two spatial axes (e.g. `[2, null,
|
|
206
|
+
* null]` for a `[time, y, x]` array with `time: 2`).
|
|
207
|
+
* @type {Array<Array<number|null>|undefined>}
|
|
208
|
+
* @private
|
|
209
|
+
*/
|
|
210
|
+
private bandExtraSelection_;
|
|
211
|
+
/**
|
|
212
|
+
* Per-band spatial (y, x) axis positions, as `{row, col}`.
|
|
213
|
+
* @type {Array<{row: number, col: number}>}
|
|
214
|
+
* @private
|
|
215
|
+
*/
|
|
216
|
+
private bandSpatialAxes_;
|
|
217
|
+
/**
|
|
218
|
+
* The two spatial axis names from the group's `spatial:dimensions` (`[y, x]`).
|
|
219
|
+
* @type {Array<string>|undefined}
|
|
220
|
+
* @private
|
|
221
|
+
*/
|
|
222
|
+
private spatialDimensionNames_;
|
|
223
|
+
/**
|
|
224
|
+
* Non-spatial dimensions of the bands, exposed via {@link getDimensions}.
|
|
225
|
+
* @type {Array<{name: string, size: number}>}
|
|
226
|
+
* @private
|
|
227
|
+
*/
|
|
228
|
+
private extraDimensions_;
|
|
229
|
+
/**
|
|
230
|
+
* @type {Object<string, Array<string>>|null|undefined}
|
|
231
|
+
* @private
|
|
232
|
+
*/
|
|
233
|
+
private bandsByLevel_;
|
|
234
|
+
/**
|
|
235
|
+
* @type {number|undefined}
|
|
236
|
+
* @private
|
|
237
|
+
*/
|
|
238
|
+
private fillValue_;
|
|
239
|
+
/**
|
|
240
|
+
* @type {ResampleMethod}
|
|
241
|
+
* @private
|
|
242
|
+
*/
|
|
243
|
+
private resampleMethod_;
|
|
244
|
+
/**
|
|
245
|
+
* @type {import("ol/tilegrid/WMTS.js").default}
|
|
246
|
+
* @override
|
|
247
|
+
*/
|
|
248
|
+
override tileGrid: import("ol/tilegrid/WMTS.js").default;
|
|
249
|
+
configure_(): Promise<void>;
|
|
250
|
+
/**
|
|
251
|
+
* @param {number} z The z tile index.
|
|
252
|
+
* @param {number} x The x tile index.
|
|
253
|
+
* @param {number} y The y tile index.
|
|
254
|
+
* @param {import('ol/source/DataTile.js').LoaderOptions} options The loader options.
|
|
255
|
+
* @return {Promise<import("ol/DataTile.js").Data>} The composed tile data.
|
|
256
|
+
* @private
|
|
257
|
+
*/
|
|
258
|
+
private loadTile_;
|
|
259
|
+
/**
|
|
260
|
+
* For multi-group mode: determine which group owns each band and supplement
|
|
261
|
+
* bandsByLevel with bands from additional groups.
|
|
262
|
+
* @private
|
|
263
|
+
*/
|
|
264
|
+
private resolveBandOwnership_;
|
|
265
|
+
/**
|
|
266
|
+
* Open a Zarr array (path relative to its group) through the shared cache, so
|
|
267
|
+
* concurrent opens of the same array are deduplicated.
|
|
268
|
+
* @param {number} groupIndex The band's group index.
|
|
269
|
+
* @param {string} path The array path relative to the group.
|
|
270
|
+
* @return {Promise<import('zarrita').Array<import('zarrita').DataType, any>>} The array.
|
|
271
|
+
* @private
|
|
272
|
+
*/
|
|
273
|
+
private openArray_;
|
|
274
|
+
/**
|
|
275
|
+
* Consolidated metadata for a group, with keys relative to that group.
|
|
276
|
+
* @param {number} groupIndex The group index.
|
|
277
|
+
* @return {Object<string, *>} The group's consolidated metadata.
|
|
278
|
+
* @private
|
|
279
|
+
*/
|
|
280
|
+
private groupMetadata_;
|
|
281
|
+
/**
|
|
282
|
+
* Look up a band's Zarr v3 array metadata from consolidated metadata, trying
|
|
283
|
+
* the multi-scale key (`<matrixId>/<band>`) first and falling back to a
|
|
284
|
+
* single-scale key (`<band>`).
|
|
285
|
+
* @param {string} band The band name.
|
|
286
|
+
* @param {number} groupIndex The index of the band's group.
|
|
287
|
+
* @return {Object<string, *>|undefined} The array metadata, or undefined when unavailable.
|
|
288
|
+
* @private
|
|
289
|
+
*/
|
|
290
|
+
private getBandArrayMeta_;
|
|
291
|
+
/**
|
|
292
|
+
* Locate the 1-D coordinate array for a non-spatial dimension, by name among
|
|
293
|
+
* the group's 1-D arrays.
|
|
294
|
+
* @param {string} name The dimension name.
|
|
295
|
+
* @return {{path: string, groupIndex: number, meta: Object<string, *>}|null} The path
|
|
296
|
+
* (relative to the group), group index, and array metadata; or `null`.
|
|
297
|
+
* @private
|
|
298
|
+
*/
|
|
299
|
+
private coordinateArray_;
|
|
300
|
+
/**
|
|
301
|
+
* Get the non-spatial dimensions of the bands (e.g. `time`) that can be fixed
|
|
302
|
+
* through the `dimensions` option, keyed by dimension name. Each entry has its
|
|
303
|
+
* `size` and the `attributes` of its coordinate array (e.g. `units`, for
|
|
304
|
+
* interpreting the values from {@link getValue}), or `attributes: null` when
|
|
305
|
+
* there is no coordinate array. Resolves with an empty object for 2-D bands,
|
|
306
|
+
* once the source is `ready`; rejects if the source fails to load.
|
|
307
|
+
* @return {Promise<Object<string, {size: number, attributes: Object|null}>>}
|
|
308
|
+
* The selectable dimensions.
|
|
309
|
+
*/
|
|
310
|
+
getDimensions(): Promise<{
|
|
311
|
+
[x: string]: {
|
|
312
|
+
size: number;
|
|
313
|
+
attributes: any | null;
|
|
314
|
+
};
|
|
315
|
+
}>;
|
|
316
|
+
/**
|
|
317
|
+
* Read the coordinate value at an index along a non-spatial dimension (e.g.
|
|
318
|
+
* the timestamp for a `time` index), for labeling the current selection. The
|
|
319
|
+
* value is returned raw (as stored, e.g. a `bigint` for a 64-bit integer
|
|
320
|
+
* axis); use the `attributes` from {@link getDimensions} to interpret it.
|
|
321
|
+
* Returns `null` for a dimension without a coordinate array. Available once
|
|
322
|
+
* the source is `ready`.
|
|
323
|
+
* @param {string} name The dimension name (see {@link getDimensions}).
|
|
324
|
+
* @param {number} index The index along the dimension.
|
|
325
|
+
* @return {Promise<number|bigint|null>} The coordinate value, or null.
|
|
326
|
+
*/
|
|
327
|
+
getValue(name: string, index: number): Promise<number | bigint | null>;
|
|
328
|
+
/**
|
|
329
|
+
* Change the fixed index of one or more non-spatial dimensions (e.g. move to
|
|
330
|
+
* another `time` slice) without rebuilding the source. Values are merged into
|
|
331
|
+
* the current selection, so a partial update like `{time: 3}` leaves the other
|
|
332
|
+
* dimensions untouched. Takes effect immediately when the source is `ready`,
|
|
333
|
+
* otherwise once it becomes ready. Only integer indices are accepted here;
|
|
334
|
+
* coordinate labels are resolved once, when the source configures.
|
|
335
|
+
* @param {Object<string, number>} dimensions Index per dimension name
|
|
336
|
+
* to change; see the `dimensions` constructor option.
|
|
337
|
+
*/
|
|
338
|
+
updateDimensions(dimensions: {
|
|
339
|
+
[x: string]: number;
|
|
340
|
+
}): void;
|
|
341
|
+
/**
|
|
342
|
+
* Locate the spatial (y, x) axes of an array (see {@link getSpatialAxes}) and
|
|
343
|
+
* its remaining non-spatial axes.
|
|
344
|
+
* @param {Object<string, *>|undefined} arrayMeta Zarr v3 array metadata.
|
|
345
|
+
* @return {{row: number, col: number, extra: Array<number>}} The row (y) and
|
|
346
|
+
* column (x) axis positions and the remaining extra axes, in array order.
|
|
347
|
+
* @private
|
|
348
|
+
*/
|
|
349
|
+
private axesOf_;
|
|
350
|
+
/**
|
|
351
|
+
* Describe the non-spatial dimensions of an array. Each is named by its
|
|
352
|
+
* `dimension_names` entry, or by its axis position when there are none.
|
|
353
|
+
* @param {Object<string, *>|undefined} arrayMeta Zarr v3 array metadata.
|
|
354
|
+
* @return {Array<{name: string, size: number, axis: number}>} The extra dimensions, outermost first.
|
|
355
|
+
* @private
|
|
356
|
+
*/
|
|
357
|
+
private extraDimsOf_;
|
|
358
|
+
/**
|
|
359
|
+
* Resolve the fixed index for each non-spatial dimension of a band array from
|
|
360
|
+
* the `dimensions` option. Returns `undefined` for 2-D arrays, otherwise an
|
|
361
|
+
* array aligned to the array rank with a fixed integer at each extra axis and
|
|
362
|
+
* `null` at the two spatial axes (e.g. `[2, null, null]` for a `[time, y, x]`
|
|
363
|
+
* array with `{time: 2}`).
|
|
364
|
+
* @param {Object<string, *>|undefined} arrayMeta Zarr v3 array metadata.
|
|
365
|
+
* @param {Object<string, number|string|Array<number|string>>} dimensions The
|
|
366
|
+
* dimension indices to resolve against.
|
|
367
|
+
* @return {Array<number|null>|undefined} The extra-axis selection template.
|
|
368
|
+
* @private
|
|
369
|
+
*/
|
|
370
|
+
private resolveExtraSelection_;
|
|
371
|
+
/**
|
|
372
|
+
* Build the tile grid and the per-level band layout. Every store is read as a
|
|
373
|
+
* stack of levels holding n-dimensional arrays: in `variable` mode all bands
|
|
374
|
+
* are slices of one array, otherwise each band has an array of its own.
|
|
375
|
+
* @param {Object<string, *>} attributes The dataset attributes.
|
|
376
|
+
* @param {FetchStore} store The store, for metadata requests not covered
|
|
377
|
+
* by consolidated metadata.
|
|
378
|
+
* @return {Promise<boolean>} Whether the tile grid has explicit tile sizes.
|
|
379
|
+
* @private
|
|
380
|
+
*/
|
|
381
|
+
private configureLevels_;
|
|
382
|
+
/**
|
|
383
|
+
* Determine the projection from the store metadata: the proj: convention,
|
|
384
|
+
* a CRS code from the multiscale metadata or xarray-style attributes, a
|
|
385
|
+
* `proj4` definition, or (for degree-like extents) EPSG:4326.
|
|
386
|
+
* @param {Object<string, *>} attributes The dataset attributes.
|
|
387
|
+
* @param {string|null} crsHint A CRS code from the multiscale metadata.
|
|
388
|
+
* @param {import("ol/extent.js").Extent} extent The extent.
|
|
389
|
+
* @return {import("ol/proj/Projection.js").default} The projection.
|
|
390
|
+
* @private
|
|
391
|
+
*/
|
|
392
|
+
private inferProjection_;
|
|
393
|
+
/**
|
|
394
|
+
* Read the first and last value of a 1-dimensional coordinate array.
|
|
395
|
+
* @param {string} levelPath The level group path ('' for the root).
|
|
396
|
+
* @param {string} dimName The dimension (and coordinate array) name.
|
|
397
|
+
* @return {Promise<Array<number>>} The first value, last value, and length.
|
|
398
|
+
* @private
|
|
399
|
+
*/
|
|
400
|
+
private readCoordinateEndpoints_;
|
|
401
|
+
/**
|
|
402
|
+
* Resolve a coordinate label to its index by reading the dimension's
|
|
403
|
+
* coordinate array.
|
|
404
|
+
* @param {string} dimName The dimension name.
|
|
405
|
+
* @param {string} label The label to resolve.
|
|
406
|
+
* @param {string} path The coordinate array path, relative to the group.
|
|
407
|
+
* @return {Promise<number>} The index of the label.
|
|
408
|
+
* @private
|
|
409
|
+
*/
|
|
410
|
+
private resolveCoordinateLabel_;
|
|
411
|
+
}
|
|
412
|
+
export type ShardInfo = {
|
|
413
|
+
/**
|
|
414
|
+
* The shard (outer chunk) shape [rows, cols].
|
|
415
|
+
*/
|
|
416
|
+
shardShape: Array<number>;
|
|
417
|
+
/**
|
|
418
|
+
* The inner chunk shape [rows, cols].
|
|
419
|
+
*/
|
|
420
|
+
innerChunkShape: Array<number>;
|
|
421
|
+
};
|
|
422
|
+
export type ResampleMethod = "nearest" | "linear";
|
|
423
|
+
export type Band = {
|
|
424
|
+
/**
|
|
425
|
+
* The band name.
|
|
426
|
+
*/
|
|
427
|
+
name: string;
|
|
428
|
+
/**
|
|
429
|
+
* The group path relative to the `url`, containing this band
|
|
430
|
+
* (e.g. `'measurements/reflectance'`).
|
|
431
|
+
*/
|
|
432
|
+
group: string;
|
|
433
|
+
};
|
|
434
|
+
export type GeoZarrStoreOptions = {
|
|
435
|
+
/**
|
|
436
|
+
* additional key-value pairs of headers to be passed with each request. Key is the header name, value the header value.
|
|
437
|
+
*/
|
|
438
|
+
headers?: {
|
|
439
|
+
[x: string]: string;
|
|
440
|
+
} | undefined;
|
|
441
|
+
/**
|
|
442
|
+
* How credentials shall be handled. See
|
|
443
|
+
* https://developer.mozilla.org/en-US/docs/Web/API/fetch for reference and possible values
|
|
444
|
+
*/
|
|
445
|
+
credentials?: string | undefined;
|
|
446
|
+
};
|
|
447
|
+
export type Options = {
|
|
448
|
+
/**
|
|
449
|
+
* When `bands` contains plain strings, this must be the full URL to the
|
|
450
|
+
* multiscales group (e.g. `'https://example.com/store.zarr/measurements/reflectance'`).
|
|
451
|
+
* When `bands` contains {@link Band} objects, this is the base URL from which each band's
|
|
452
|
+
* `group` path is resolved (e.g. `'https://example.com/store.zarr/satellite/sentinel2'`).
|
|
453
|
+
*/
|
|
454
|
+
url: string;
|
|
455
|
+
/**
|
|
456
|
+
* The bands to render, for stores where each
|
|
457
|
+
* band is a separate array. Mutually exclusive with `variable`. Each entry is either a band name
|
|
458
|
+
* string (single-group mode) or a {@link Band} object specifying both the band name and the
|
|
459
|
+
* group it belongs to (multi-group mode). In multi-group mode, the first band's group
|
|
460
|
+
* determines the tile grid and must follow at least the proj: and spatial: conventions.
|
|
461
|
+
* If it also has a multiscales layout (all three conventions), multiple resolution levels are
|
|
462
|
+
* supported. Otherwise a single-resolution tile grid is derived from `spatial:bbox`,
|
|
463
|
+
* `proj:code`, and `spatial:shape` (or the array shape from consolidated metadata).
|
|
464
|
+
* Bands from additional groups do not need to follow any convention; they can be multi-scale
|
|
465
|
+
* (array located at `<matrixId>/<bandName>`) or single-scale (array at the group root).
|
|
466
|
+
*/
|
|
467
|
+
bands?: (string | Band)[] | undefined;
|
|
468
|
+
/**
|
|
469
|
+
* Additional options to be passed to
|
|
470
|
+
* [zarrita](https://zarrita.dev/)'s `FetchStore` with each request to the Zarr store.
|
|
471
|
+
*/
|
|
472
|
+
storeOptions?: GeoZarrStoreOptions | undefined;
|
|
473
|
+
/**
|
|
474
|
+
* Source projection.
|
|
475
|
+
* If not provided, the GeoZarr metadata will be read for projection information.
|
|
476
|
+
*/
|
|
477
|
+
projection?: import("ol/proj.js").ProjectionLike;
|
|
478
|
+
/**
|
|
479
|
+
* Duration of the opacity transition for rendering.
|
|
480
|
+
* To disable the opacity transition, pass `transition: 0`.
|
|
481
|
+
*/
|
|
482
|
+
transition?: number | undefined;
|
|
483
|
+
/**
|
|
484
|
+
* Render tiles beyond the tile grid extent.
|
|
485
|
+
*/
|
|
486
|
+
wrapX?: boolean | undefined;
|
|
487
|
+
/**
|
|
488
|
+
* Resampling method if bands are not available for all multi-scale levels.
|
|
489
|
+
*/
|
|
490
|
+
resample?: ResampleMethod | undefined;
|
|
491
|
+
/**
|
|
492
|
+
* How to slice
|
|
493
|
+
* each non-spatial dimension of the band arrays, keyed by dimension name (e.g. `{time: 0}` for
|
|
494
|
+
* the first time step of a `[time, y, x]` cube). Values are 0-based indices (number) or
|
|
495
|
+
* coordinate labels (string); unlisted dimensions default to index 0. Names come from each
|
|
496
|
+
* array's `dimension_names`, or are the axis position as a string when it has none; use the
|
|
497
|
+
* names from {@link getDimensions}. Labels are resolved against the dimension's coordinate
|
|
498
|
+
* array; if that array cannot be read, pass indices instead. With `variable`, at most one
|
|
499
|
+
* dimension may map to an array of values, whose entries are rendered as separate bands in
|
|
500
|
+
* the given order. Change the selection on the fly with
|
|
501
|
+
* {@link module :ol/source/GeoZarr~GeoZarr#updateDimensions}.
|
|
502
|
+
*/
|
|
503
|
+
dimensions?: {
|
|
504
|
+
[x: string]: string | number | (string | number)[];
|
|
505
|
+
} | undefined;
|
|
506
|
+
/**
|
|
507
|
+
* The name of an n-dimensional data array (variable) to
|
|
508
|
+
* render, for stores where all bands are packed into a single array (e.g. a
|
|
509
|
+
* `(time, band, y, x)` datacube). The array must exist within each multiscale level
|
|
510
|
+
* group (or at the group root for single-scale stores). Mutually exclusive with `bands`,
|
|
511
|
+
* and required to select several bands from one dimension through `dimensions`.
|
|
512
|
+
*/
|
|
513
|
+
variable?: string | undefined;
|
|
514
|
+
/**
|
|
515
|
+
* Fallback extent of the data, in
|
|
516
|
+
* coordinates of the source projection. Only used when the store neither declares its
|
|
517
|
+
* extent (`spatial:bbox` or `bounds` attributes) nor has coordinate arrays to infer it.
|
|
518
|
+
*/
|
|
519
|
+
extent?: import("ol/extent.js").Extent | undefined;
|
|
520
|
+
/**
|
|
521
|
+
* Fallback orientation: set to `true` when the data is
|
|
522
|
+
* stored south-up (ascending y). Only used when the orientation can neither be read
|
|
523
|
+
* from the store metadata nor inferred from its coordinate arrays.
|
|
524
|
+
*/
|
|
525
|
+
flipY?: boolean | undefined;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* *
|
|
529
|
+
*/
|
|
530
|
+
export type DatasetAttributes = {
|
|
531
|
+
multiscales: Multiscales;
|
|
532
|
+
zarr_conventions: Array<{
|
|
533
|
+
uuid: string;
|
|
534
|
+
}>;
|
|
535
|
+
"spatial:bbox": import("ol/extent.js").Extent;
|
|
536
|
+
"spatial:shape": Array<number>;
|
|
537
|
+
"spatial:dimensions"?: Array<string>;
|
|
538
|
+
"proj:wkt2"?: string;
|
|
539
|
+
"proj:projjson"?: any;
|
|
540
|
+
"proj:code"?: string | null;
|
|
541
|
+
};
|
|
542
|
+
export type Multiscales = {
|
|
543
|
+
/**
|
|
544
|
+
* The layout.
|
|
545
|
+
*/
|
|
546
|
+
layout: Array<{
|
|
547
|
+
[x: string]: any;
|
|
548
|
+
}>;
|
|
549
|
+
};
|
|
550
|
+
export type LegacyDatasetAttributes = {
|
|
551
|
+
/**
|
|
552
|
+
* The multiscales attribute.
|
|
553
|
+
*/
|
|
554
|
+
multiscales: LegacyMultiscales;
|
|
555
|
+
};
|
|
556
|
+
export type LegacyMultiscales = {
|
|
557
|
+
/**
|
|
558
|
+
* The tile matrix limits.
|
|
559
|
+
*/
|
|
560
|
+
tile_matrix_limits: any;
|
|
561
|
+
/**
|
|
562
|
+
* The tile matrix set.
|
|
563
|
+
*/
|
|
564
|
+
tile_matrix_set: any;
|
|
565
|
+
};
|
|
566
|
+
export type TileGridInfo = {
|
|
567
|
+
/**
|
|
568
|
+
* The tile grid.
|
|
569
|
+
*/
|
|
570
|
+
tileGrid: WMTSTileGrid;
|
|
571
|
+
/**
|
|
572
|
+
* The projection.
|
|
573
|
+
*/
|
|
574
|
+
projection: import("ol/proj/Projection.js").default;
|
|
575
|
+
};
|
|
576
|
+
import DataTileSource from 'ol/source/DataTile.js';
|
|
577
|
+
import WMTSTileGrid from 'ol/tilegrid/WMTS.js';
|
|
578
|
+
//# sourceMappingURL=GeoZarr.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GeoZarr.d.ts","sourceRoot":"","sources":["../../../src/ol/source/GeoZarr.js"],"names":[],"mappings":"AAuBA;;GAEG;AAEH;;;;;GAKG;AAEH;;;;;GAKG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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