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