isard 0.7.0 → 0.8.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/CHANGELOG.md +47 -0
- package/dist/basemap.worker.d.ts +7 -1
- package/dist/basemap.worker.js +2 -2
- package/dist/basemap.worker.js.map +8 -7
- package/dist/decoder.worker.js +4 -4
- package/dist/decoder.worker.js.map +6 -5
- package/dist/engine-loader.d.ts +1 -1
- package/dist/engine-loader.js.map +1 -1
- package/dist/geoplateforme.js +2 -1
- package/dist/geoplateforme.js.map +1 -1
- package/dist/glyphs.js +2 -1
- package/dist/glyphs.js.map +1 -1
- package/dist/icons.js +5 -1
- package/dist/icons.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/interaction.d.ts +2 -0
- package/dist/interaction.js +29 -2
- package/dist/interaction.js.map +1 -1
- package/dist/isard_bg.wasm +0 -0
- package/dist/isard_core_bg.wasm +0 -0
- package/dist/layers.d.ts +2 -0
- package/dist/layers.js +22 -4
- package/dist/layers.js.map +1 -1
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +10 -0
- package/dist/loader.js.map +1 -1
- package/dist/map.d.ts +38 -1
- package/dist/map.js +153 -2
- package/dist/map.js.map +1 -1
- package/dist/overlay.d.ts +40 -0
- package/dist/overlay.js +119 -0
- package/dist/overlay.js.map +1 -1
- package/dist/panoramas.d.ts +94 -0
- package/dist/panoramas.js +245 -0
- package/dist/panoramas.js.map +1 -0
- package/dist/pmtiles.js +3 -2
- package/dist/pmtiles.js.map +1 -1
- package/dist/pointclouds.js +1 -1
- package/dist/pointclouds.js.map +1 -1
- package/dist/protocol.d.ts +7 -1
- package/dist/protocol.js.map +1 -1
- package/dist/requests.d.ts +14 -0
- package/dist/requests.js +48 -0
- package/dist/requests.js.map +1 -0
- package/dist/resample.js +2 -1
- package/dist/resample.js.map +1 -1
- package/dist/style.js +1 -0
- package/dist/style.js.map +1 -1
- package/dist/terrain.d.ts +0 -5
- package/dist/terrain.js +2 -1
- package/dist/terrain.js.map +1 -1
- package/dist/types.d.ts +29 -1
- package/dist/types.js.map +1 -1
- package/dist/vectortiles.js +12 -1
- package/dist/vectortiles.js.map +1 -1
- package/dist/wasm/isard.d.ts +79 -5
- package/dist/wasm/isard.js +165 -7
- package/dist/wasm/isard_core.d.ts +38 -0
- package/dist/wasm/isard_core.js +99 -0
- package/dist/wmts.js +2 -1
- package/dist/wmts.js.map +1 -1
- package/package.json +1 -1
package/dist/wasm/isard.js
CHANGED
|
@@ -228,14 +228,16 @@ export class Engine {
|
|
|
228
228
|
/**
|
|
229
229
|
* 3D Tiles (b3dm / glb textured meshes, external tilesets) from the URL of a `tileset.json`. `max_error`:
|
|
230
230
|
* screen-space error (CSS pixels) above which a tile is refined; 16 is the usual value, lower is finer.
|
|
231
|
+
* `geoid`: its heights are altitudes (NGF-IGN69), each tile raised by the RAF20 geoid onto the relief.
|
|
231
232
|
* @param {string} url
|
|
232
233
|
* @param {number} max_error
|
|
234
|
+
* @param {boolean | null} [geoid]
|
|
233
235
|
* @returns {number}
|
|
234
236
|
*/
|
|
235
|
-
addTiles3d(url, max_error) {
|
|
237
|
+
addTiles3d(url, max_error, geoid) {
|
|
236
238
|
const ptr0 = passStringToWasm0(url, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
237
239
|
const len0 = WASM_VECTOR_LEN;
|
|
238
|
-
const ret = wasm.engine_addTiles3d(this.__wbg_ptr, ptr0, len0, max_error);
|
|
240
|
+
const ret = wasm.engine_addTiles3d(this.__wbg_ptr, ptr0, len0, max_error, isLikeNone(geoid) ? 0xFFFFFF : geoid ? 1 : 0);
|
|
239
241
|
if (ret[2]) {
|
|
240
242
|
throw takeFromExternrefTable0(ret[1]);
|
|
241
243
|
}
|
|
@@ -259,6 +261,12 @@ export class Engine {
|
|
|
259
261
|
const ret = wasm.engine_camera(this.__wbg_ptr);
|
|
260
262
|
return ret;
|
|
261
263
|
}
|
|
264
|
+
/**
|
|
265
|
+
* Removes the panorama
|
|
266
|
+
*/
|
|
267
|
+
clearPanorama() {
|
|
268
|
+
wasm.engine_clearPanorama(this.__wbg_ptr);
|
|
269
|
+
}
|
|
262
270
|
clearPreload() {
|
|
263
271
|
wasm.engine_clearPreload(this.__wbg_ptr);
|
|
264
272
|
}
|
|
@@ -286,6 +294,28 @@ export class Engine {
|
|
|
286
294
|
}
|
|
287
295
|
return v1;
|
|
288
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Altitude of the relief at a position (metres, exaggeration included), from the copy of its tiles kept on the
|
|
299
|
+
* CPU (as coarse as the tiles loaded there); undefined without relief or where none is loaded
|
|
300
|
+
* @param {number} lon
|
|
301
|
+
* @param {number} lat
|
|
302
|
+
* @returns {number | undefined}
|
|
303
|
+
*/
|
|
304
|
+
elevationAt(lon, lat) {
|
|
305
|
+
const ret = wasm.engine_elevationAt(this.__wbg_ptr, lon, lat);
|
|
306
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what raises
|
|
310
|
+
* the altitudes (NGF-IGN69) of a source onto the IGN relief
|
|
311
|
+
* @param {number} lon
|
|
312
|
+
* @param {number} lat
|
|
313
|
+
* @returns {number}
|
|
314
|
+
*/
|
|
315
|
+
static geoidHeight(lon, lat) {
|
|
316
|
+
const ret = wasm.engine_geoidHeight(lon, lat);
|
|
317
|
+
return ret;
|
|
318
|
+
}
|
|
289
319
|
/**
|
|
290
320
|
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
291
321
|
* @param {number} x
|
|
@@ -307,6 +337,21 @@ export class Engine {
|
|
|
307
337
|
linkExtrusionNetwork(id, network, max) {
|
|
308
338
|
wasm.engine_linkExtrusionNetwork(this.__wbg_ptr, id, isLikeNone(network) ? Number.MAX_SAFE_INTEGER : (network) >>> 0, max);
|
|
309
339
|
}
|
|
340
|
+
/**
|
|
341
|
+
* Model-view-projection matrix (16 numbers, column-major) of the local frame at a longitude, latitude (degrees)
|
|
342
|
+
* and altitude (metres), x east, y north, z up, in metres, for the last frame drawn (else the camera): the 3D
|
|
343
|
+
* overlays of the page (`Panel`) placed with it after each frame
|
|
344
|
+
* @param {number} lon
|
|
345
|
+
* @param {number} lat
|
|
346
|
+
* @param {number} altitude
|
|
347
|
+
* @returns {Float32Array}
|
|
348
|
+
*/
|
|
349
|
+
localMatrix(lon, lat, altitude) {
|
|
350
|
+
const ret = wasm.engine_localMatrix(this.__wbg_ptr, lon, lat, altitude);
|
|
351
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
352
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
353
|
+
return v1;
|
|
354
|
+
}
|
|
310
355
|
/**
|
|
311
356
|
* Moves a layer to a drawing position (0 = bottom)
|
|
312
357
|
* @param {number} id
|
|
@@ -666,6 +711,20 @@ export class Engine {
|
|
|
666
711
|
const len3 = WASM_VECTOR_LEN;
|
|
667
712
|
wasm.engine_setFills(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
668
713
|
}
|
|
714
|
+
/**
|
|
715
|
+
* A street-level view: the eye `height` metres above the ground at `lon`, `lat` (degrees), looking `bearing`
|
|
716
|
+
* (degrees clockwise from north) and `pitch` (0 straight down, 90 level, 180 straight up), with a vertical field
|
|
717
|
+
* of view of `fov` degrees. A camera set with `setCamera` turns around a point again
|
|
718
|
+
* @param {number} lon
|
|
719
|
+
* @param {number} lat
|
|
720
|
+
* @param {number} height
|
|
721
|
+
* @param {number} bearing
|
|
722
|
+
* @param {number} pitch
|
|
723
|
+
* @param {number} fov
|
|
724
|
+
*/
|
|
725
|
+
setFirstPerson(lon, lat, height, bearing, pitch, fov) {
|
|
726
|
+
wasm.engine_setFirstPerson(this.__wbg_ptr, lon, lat, height, bearing, pitch, fov);
|
|
727
|
+
}
|
|
669
728
|
/**
|
|
670
729
|
* Color of the globe under the tiles (polar caps)
|
|
671
730
|
* @param {number} r
|
|
@@ -887,6 +946,41 @@ export class Engine {
|
|
|
887
946
|
const len0 = WASM_VECTOR_LEN;
|
|
888
947
|
wasm.engine_setNetworkValues(this.__wbg_ptr, id, ptr0, len0);
|
|
889
948
|
}
|
|
949
|
+
/**
|
|
950
|
+
* The image of camera `index` of the panorama (the images sharing the size of the first)
|
|
951
|
+
* @param {number} index
|
|
952
|
+
* @param {ImageBitmap} image
|
|
953
|
+
*/
|
|
954
|
+
setPanoramaImage(index, image) {
|
|
955
|
+
const ret = wasm.engine_setPanoramaImage(this.__wbg_ptr, index, image);
|
|
956
|
+
if (ret[1]) {
|
|
957
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* Shows a panorama: at `lon`, `lat` (degrees) and `height` (metres above the ellipsoid), turned by `rotation`
|
|
962
|
+
* (9 numbers, row-major: its frame to east, north, up), its `cameras` (25 numbers each: rotation from the panorama
|
|
963
|
+
* frame, row-major, 9; position in it, 3; focal x, y; center x, y; skew; image width, height; principal point of
|
|
964
|
+
* the distortion x, y; its coefficients r³, r⁵, r⁷; its limit, pixels), a backdrop sphere of `radius` metres, at
|
|
965
|
+
* `opacity`. Its images come after (`setPanoramaImage`)
|
|
966
|
+
* @param {number} lon
|
|
967
|
+
* @param {number} lat
|
|
968
|
+
* @param {number} height
|
|
969
|
+
* @param {Float64Array} rotation
|
|
970
|
+
* @param {Float64Array} cameras
|
|
971
|
+
* @param {number} radius
|
|
972
|
+
* @param {number} opacity
|
|
973
|
+
*/
|
|
974
|
+
setPanorama(lon, lat, height, rotation, cameras, radius, opacity) {
|
|
975
|
+
const ptr0 = passArrayF64ToWasm0(rotation, wasm.__wbindgen_malloc);
|
|
976
|
+
const len0 = WASM_VECTOR_LEN;
|
|
977
|
+
const ptr1 = passArrayF64ToWasm0(cameras, wasm.__wbindgen_malloc);
|
|
978
|
+
const len1 = WASM_VECTOR_LEN;
|
|
979
|
+
const ret = wasm.engine_setPanorama(this.__wbg_ptr, lon, lat, height, ptr0, len0, ptr1, len1, radius, opacity);
|
|
980
|
+
if (ret[1]) {
|
|
981
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
982
|
+
}
|
|
983
|
+
}
|
|
890
984
|
/**
|
|
891
985
|
* The style of a point cloud: 14 numbers (see `Style::parse`), the colors of the 256 classes (RGBA,
|
|
892
986
|
* alpha 0 hides a class) and the ramp of the altitudes (256 RGBA texels)
|
|
@@ -912,6 +1006,22 @@ export class Engine {
|
|
|
912
1006
|
setRasterStyle(id, opacity, saturation) {
|
|
913
1007
|
wasm.engine_setRasterStyle(this.__wbg_ptr, id, opacity, saturation);
|
|
914
1008
|
}
|
|
1009
|
+
/**
|
|
1010
|
+
* The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
|
|
1011
|
+
* page): `prefixes[i]` with `counts[i]` name and value pairs, in order, flattened into `pairs`
|
|
1012
|
+
* @param {string[]} prefixes
|
|
1013
|
+
* @param {Uint32Array} counts
|
|
1014
|
+
* @param {string[]} pairs
|
|
1015
|
+
*/
|
|
1016
|
+
setRequestHeaders(prefixes, counts, pairs) {
|
|
1017
|
+
const ptr0 = passArrayJsValueToWasm0(prefixes, wasm.__wbindgen_malloc);
|
|
1018
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1019
|
+
const ptr1 = passArray32ToWasm0(counts, wasm.__wbindgen_malloc);
|
|
1020
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1021
|
+
const ptr2 = passArrayJsValueToWasm0(pairs, wasm.__wbindgen_malloc);
|
|
1022
|
+
const len2 = WASM_VECTOR_LEN;
|
|
1023
|
+
wasm.engine_setRequestHeaders(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
1024
|
+
}
|
|
915
1025
|
/**
|
|
916
1026
|
* Space behind the globe (stars, atmosphere halo), in the globe projection
|
|
917
1027
|
* @param {boolean} enabled
|
|
@@ -919,6 +1029,18 @@ export class Engine {
|
|
|
919
1029
|
setSky(enabled) {
|
|
920
1030
|
wasm.engine_setSky(this.__wbg_ptr, enabled);
|
|
921
1031
|
}
|
|
1032
|
+
/**
|
|
1033
|
+
* Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
|
|
1034
|
+
* of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; a non-finite `x` stops
|
|
1035
|
+
* @param {number} x
|
|
1036
|
+
* @param {boolean} right
|
|
1037
|
+
* @param {Uint32Array} layers
|
|
1038
|
+
*/
|
|
1039
|
+
setSwipe(x, right, layers) {
|
|
1040
|
+
const ptr0 = passArray32ToWasm0(layers, wasm.__wbindgen_malloc);
|
|
1041
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1042
|
+
wasm.engine_setSwipe(this.__wbg_ptr, x, right, ptr0, len0);
|
|
1043
|
+
}
|
|
922
1044
|
/**
|
|
923
1045
|
* Layer-wide style of a symbol layer: size scale and opacity as zoom stops (four zooms then four values each),
|
|
924
1046
|
* zoom range, visibility
|
|
@@ -993,14 +1115,18 @@ export class Engine {
|
|
|
993
1115
|
wasm.engine_setTileLoader(this.__wbg_ptr, loader);
|
|
994
1116
|
}
|
|
995
1117
|
/**
|
|
996
|
-
* Screen-space error threshold, opacity
|
|
1118
|
+
* Screen-space error threshold, opacity, size of the points (CSS pixels, 2 if not given) and color (RGB 0-1, empty
|
|
1119
|
+
* for none: it tints the textures and colors the untextured meshes) of a 3D Tiles layer
|
|
997
1120
|
* @param {number} id
|
|
998
1121
|
* @param {number} max_error
|
|
999
1122
|
* @param {number} opacity
|
|
1000
|
-
* @param {number | null}
|
|
1123
|
+
* @param {number | null | undefined} point_size
|
|
1124
|
+
* @param {Float32Array} color
|
|
1001
1125
|
*/
|
|
1002
|
-
setTiles3dStyle(id, max_error, opacity, point_size) {
|
|
1003
|
-
|
|
1126
|
+
setTiles3dStyle(id, max_error, opacity, point_size, color) {
|
|
1127
|
+
const ptr0 = passArrayF32ToWasm0(color, wasm.__wbindgen_malloc);
|
|
1128
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1129
|
+
wasm.engine_setTiles3dStyle(this.__wbg_ptr, id, max_error, opacity, !isLikeNone(point_size), isLikeNone(point_size) ? 0 : point_size, ptr0, len0);
|
|
1004
1130
|
}
|
|
1005
1131
|
/**
|
|
1006
1132
|
* Shows what can be seen from points, each within its range: `observers` holds 8 numbers per observer
|
|
@@ -1075,6 +1201,18 @@ export class Engine {
|
|
|
1075
1201
|
const ret = wasm.engine_textureFormats(this.__wbg_ptr);
|
|
1076
1202
|
return ret;
|
|
1077
1203
|
}
|
|
1204
|
+
/**
|
|
1205
|
+
* The feature of a picked handle (`pick`'s index on a 3D Tiles layer): `[properties, feature]`, its properties
|
|
1206
|
+
* (undefined when its tile has none) and its index in its tile; undefined if the handle is not of the last picking
|
|
1207
|
+
* pass
|
|
1208
|
+
* @param {number} id
|
|
1209
|
+
* @param {number} index
|
|
1210
|
+
* @returns {[properties: Record<string, unknown> | undefined, feature: number] | undefined}
|
|
1211
|
+
*/
|
|
1212
|
+
tiles3dFeature(id, index) {
|
|
1213
|
+
const ret = wasm.engine_tiles3dFeature(this.__wbg_ptr, id, index);
|
|
1214
|
+
return ret;
|
|
1215
|
+
}
|
|
1078
1216
|
/**
|
|
1079
1217
|
* Counters of a 3D Tiles layer, undefined if there is none with this id
|
|
1080
1218
|
* @param {number} id
|
|
@@ -1740,6 +1878,10 @@ function __wbg_get_imports() {
|
|
|
1740
1878
|
const ret = Reflect.get(arg0, arg1);
|
|
1741
1879
|
return ret;
|
|
1742
1880
|
}, arguments); },
|
|
1881
|
+
__wbg_get_806853698d9fc227: function() { return handleError(function (arg0, arg1) {
|
|
1882
|
+
const ret = Reflect.get(arg0, arg1 >>> 0);
|
|
1883
|
+
return ret;
|
|
1884
|
+
}, arguments); },
|
|
1743
1885
|
__wbg_get_f75619e20cb68514: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
1744
1886
|
const ret = arg1.get(getStringFromWasm0(arg2, arg3));
|
|
1745
1887
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
@@ -2364,6 +2506,12 @@ function __wbg_get_imports() {
|
|
|
2364
2506
|
__wbg_useProgram_e075c2902e420761: function(arg0, arg1) {
|
|
2365
2507
|
arg0.useProgram(arg1);
|
|
2366
2508
|
},
|
|
2509
|
+
__wbg_vertexAttrib1f_37ce0547e8fa5f36: function(arg0, arg1, arg2) {
|
|
2510
|
+
arg0.vertexAttrib1f(arg1 >>> 0, arg2);
|
|
2511
|
+
},
|
|
2512
|
+
__wbg_vertexAttrib1f_470b2556c148483a: function(arg0, arg1, arg2) {
|
|
2513
|
+
arg0.vertexAttrib1f(arg1 >>> 0, arg2);
|
|
2514
|
+
},
|
|
2367
2515
|
__wbg_vertexAttribDivisorANGLE_659fb027198a47c3: function(arg0, arg1, arg2) {
|
|
2368
2516
|
arg0.vertexAttribDivisorANGLE(arg1 >>> 0, arg2 >>> 0);
|
|
2369
2517
|
},
|
|
@@ -2393,7 +2541,7 @@ function __wbg_get_imports() {
|
|
|
2393
2541
|
return ret;
|
|
2394
2542
|
},
|
|
2395
2543
|
__wbindgen_generic_0000000000000001: function(arg0, arg1) {
|
|
2396
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
2544
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 198, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
2397
2545
|
const ret = makeMutClosure(arg0, arg1, wasm_bindgen_2e566c63402fe7fa___convert__closures_____invoke___wasm_bindgen_2e566c63402fe7fa___JsValue__core_37ee0ce0c4cd57d5___result__Result_____wasm_bindgen_2e566c63402fe7fa___JsError___true_);
|
|
2398
2546
|
return ret;
|
|
2399
2547
|
},
|
|
@@ -2744,6 +2892,16 @@ function passArrayF64ToWasm0(arg, malloc) {
|
|
|
2744
2892
|
return ptr;
|
|
2745
2893
|
}
|
|
2746
2894
|
|
|
2895
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
2896
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
2897
|
+
for (let i = 0; i < array.length; i++) {
|
|
2898
|
+
const add = addToExternrefTable0(array[i]);
|
|
2899
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
2900
|
+
}
|
|
2901
|
+
WASM_VECTOR_LEN = array.length;
|
|
2902
|
+
return ptr;
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2747
2905
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
2748
2906
|
if (realloc === undefined) {
|
|
2749
2907
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -130,6 +130,16 @@ export class Engine {
|
|
|
130
130
|
* callback of a custom layer. Static: the engine is borrowed while it draws
|
|
131
131
|
*/
|
|
132
132
|
static customMatrix(lon: number, lat: number, altitude: number): Float32Array | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* Altitude of the relief at a position (metres, exaggeration included), from the copy of its tiles kept on the
|
|
135
|
+
* CPU (as coarse as the tiles loaded there); undefined without relief or where none is loaded
|
|
136
|
+
*/
|
|
137
|
+
elevationAt(lon: number, lat: number): number | undefined;
|
|
138
|
+
/**
|
|
139
|
+
* Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what raises
|
|
140
|
+
* the altitudes (NGF-IGN69) of a source onto the IGN relief
|
|
141
|
+
*/
|
|
142
|
+
static geoidHeight(lon: number, lat: number): number;
|
|
133
143
|
/**
|
|
134
144
|
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
135
145
|
*/
|
|
@@ -140,6 +150,12 @@ export class Engine {
|
|
|
140
150
|
* through the layer's ramp, up to `max` (above: its own color)
|
|
141
151
|
*/
|
|
142
152
|
linkExtrusionNetwork(id: number, network: number | null | undefined, max: number): void;
|
|
153
|
+
/**
|
|
154
|
+
* Model-view-projection matrix (16 numbers, column-major) of the local frame at a longitude, latitude (degrees)
|
|
155
|
+
* and altitude (metres), x east, y north, z up, in metres, for the last frame drawn (else the camera): the 3D
|
|
156
|
+
* overlays of the page (`Panel`) placed with it after each frame
|
|
157
|
+
*/
|
|
158
|
+
localMatrix(lon: number, lat: number, altitude: number): Float32Array;
|
|
143
159
|
/**
|
|
144
160
|
* Moves a layer to a drawing position (0 = bottom)
|
|
145
161
|
*/
|
|
@@ -255,6 +271,12 @@ export class Engine {
|
|
|
255
271
|
* New polygons for a fill layer (same arguments as `addFills`, the same features)
|
|
256
272
|
*/
|
|
257
273
|
setFills(id: number, points: Float64Array, ring_start: Uint32Array, polygon_start: Uint32Array, feature: Uint32Array): void;
|
|
274
|
+
/**
|
|
275
|
+
* A street-level view: the eye `height` metres above the ground at `lon`, `lat` (degrees), looking `bearing`
|
|
276
|
+
* (degrees clockwise from north) and `pitch` (0 straight down, 90 level, 180 straight up), with a vertical field
|
|
277
|
+
* of view of `fov` degrees. A camera set with `setCamera` turns around a point again
|
|
278
|
+
*/
|
|
279
|
+
setFirstPerson(lon: number, lat: number, height: number, bearing: number, pitch: number, fov: number): void;
|
|
258
280
|
/**
|
|
259
281
|
* Color of the globe under the tiles (polar caps)
|
|
260
282
|
*/
|
|
@@ -331,10 +353,20 @@ export class Engine {
|
|
|
331
353
|
*/
|
|
332
354
|
setNetworkValues(id: number, values: Float32Array): void;
|
|
333
355
|
setRasterStyle(id: number, opacity: number, saturation: number): void;
|
|
356
|
+
/**
|
|
357
|
+
* The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
|
|
358
|
+
* page): `prefixes[i]` with `counts[i]` name and value pairs, in order, flattened into `pairs`
|
|
359
|
+
*/
|
|
360
|
+
setRequestHeaders(prefixes: string[], counts: Uint32Array, pairs: string[]): void;
|
|
334
361
|
/**
|
|
335
362
|
* Space behind the globe (stars, atmosphere halo), in the globe projection
|
|
336
363
|
*/
|
|
337
364
|
setSky(enabled: boolean): void;
|
|
365
|
+
/**
|
|
366
|
+
* Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
|
|
367
|
+
* of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; a non-finite `x` stops
|
|
368
|
+
*/
|
|
369
|
+
setSwipe(x: number, right: boolean, layers: Uint32Array): void;
|
|
338
370
|
/**
|
|
339
371
|
* Layer-wide style of a symbol layer: size scale and opacity as zoom stops (four zooms then four values each),
|
|
340
372
|
* zoom range, visibility
|
|
@@ -425,8 +457,11 @@ export interface InitOutput {
|
|
|
425
457
|
readonly engine_clearPreload: (a: number) => void;
|
|
426
458
|
readonly engine_clearViewshed: (a: number) => void;
|
|
427
459
|
readonly engine_customMatrix: (a: number, b: number, c: number) => [number, number];
|
|
460
|
+
readonly engine_elevationAt: (a: number, b: number, c: number) => [number, number];
|
|
461
|
+
readonly engine_geoidHeight: (a: number, b: number) => number;
|
|
428
462
|
readonly engine_ground: (a: number, b: number, c: number) => any;
|
|
429
463
|
readonly engine_linkExtrusionNetwork: (a: number, b: number, c: number, d: number) => void;
|
|
464
|
+
readonly engine_localMatrix: (a: number, b: number, c: number, d: number) => [number, number];
|
|
430
465
|
readonly engine_moveLayer: (a: number, b: number, c: number) => void;
|
|
431
466
|
readonly engine_networkStats: (a: number, b: number) => any;
|
|
432
467
|
readonly engine_new: (a: any, b: any) => [number, number, number];
|
|
@@ -455,6 +490,7 @@ export interface InitOutput {
|
|
|
455
490
|
readonly engine_setFeatureStyle: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
456
491
|
readonly engine_setFeatureValues: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
457
492
|
readonly engine_setFills: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
493
|
+
readonly engine_setFirstPerson: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
458
494
|
readonly engine_setGlobe: (a: number, b: number) => void;
|
|
459
495
|
readonly engine_setGlobeColor: (a: number, b: number, c: number, d: number) => void;
|
|
460
496
|
readonly engine_setGlyphAtlas: (a: number, b: number, c: number, d: number, e: number) => [number, number];
|
|
@@ -474,7 +510,9 @@ export interface InitOutput {
|
|
|
474
510
|
readonly engine_setNetworkStyle: (a: number, b: number, c: number, d: number) => void;
|
|
475
511
|
readonly engine_setNetworkValues: (a: number, b: number, c: number, d: number) => void;
|
|
476
512
|
readonly engine_setRasterStyle: (a: number, b: number, c: number, d: number) => void;
|
|
513
|
+
readonly engine_setRequestHeaders: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
477
514
|
readonly engine_setSky: (a: number, b: number) => void;
|
|
515
|
+
readonly engine_setSwipe: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
478
516
|
readonly engine_setSymbolLayer: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
479
517
|
readonly engine_setSymbols: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => [number, number];
|
|
480
518
|
readonly engine_setTerrain: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number];
|
package/dist/wasm/isard_core.js
CHANGED
|
@@ -233,6 +233,28 @@ export class Engine {
|
|
|
233
233
|
}
|
|
234
234
|
return v1;
|
|
235
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* Altitude of the relief at a position (metres, exaggeration included), from the copy of its tiles kept on the
|
|
238
|
+
* CPU (as coarse as the tiles loaded there); undefined without relief or where none is loaded
|
|
239
|
+
* @param {number} lon
|
|
240
|
+
* @param {number} lat
|
|
241
|
+
* @returns {number | undefined}
|
|
242
|
+
*/
|
|
243
|
+
elevationAt(lon, lat) {
|
|
244
|
+
const ret = wasm.engine_elevationAt(this.__wbg_ptr, lon, lat);
|
|
245
|
+
return ret[0] === 0 ? undefined : ret[1];
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Height of the RAF20 geoid above the ellipsoid at a position (metres; 0 away from mainland France): what raises
|
|
249
|
+
* the altitudes (NGF-IGN69) of a source onto the IGN relief
|
|
250
|
+
* @param {number} lon
|
|
251
|
+
* @param {number} lat
|
|
252
|
+
* @returns {number}
|
|
253
|
+
*/
|
|
254
|
+
static geoidHeight(lon, lat) {
|
|
255
|
+
const ret = wasm.engine_geoidHeight(lon, lat);
|
|
256
|
+
return ret;
|
|
257
|
+
}
|
|
236
258
|
/**
|
|
237
259
|
* Position under a screen point (CSS pixels), undefined above the horizon; on the relief itself
|
|
238
260
|
* @param {number} x
|
|
@@ -254,6 +276,21 @@ export class Engine {
|
|
|
254
276
|
linkExtrusionNetwork(id, network, max) {
|
|
255
277
|
wasm.engine_linkExtrusionNetwork(this.__wbg_ptr, id, isLikeNone(network) ? Number.MAX_SAFE_INTEGER : (network) >>> 0, max);
|
|
256
278
|
}
|
|
279
|
+
/**
|
|
280
|
+
* Model-view-projection matrix (16 numbers, column-major) of the local frame at a longitude, latitude (degrees)
|
|
281
|
+
* and altitude (metres), x east, y north, z up, in metres, for the last frame drawn (else the camera): the 3D
|
|
282
|
+
* overlays of the page (`Panel`) placed with it after each frame
|
|
283
|
+
* @param {number} lon
|
|
284
|
+
* @param {number} lat
|
|
285
|
+
* @param {number} altitude
|
|
286
|
+
* @returns {Float32Array}
|
|
287
|
+
*/
|
|
288
|
+
localMatrix(lon, lat, altitude) {
|
|
289
|
+
const ret = wasm.engine_localMatrix(this.__wbg_ptr, lon, lat, altitude);
|
|
290
|
+
var v1 = getArrayF32FromWasm0(ret[0], ret[1]).slice();
|
|
291
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
292
|
+
return v1;
|
|
293
|
+
}
|
|
257
294
|
/**
|
|
258
295
|
* Moves a layer to a drawing position (0 = bottom)
|
|
259
296
|
* @param {number} id
|
|
@@ -584,6 +621,20 @@ export class Engine {
|
|
|
584
621
|
const len3 = WASM_VECTOR_LEN;
|
|
585
622
|
wasm.engine_setFills(this.__wbg_ptr, id, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
586
623
|
}
|
|
624
|
+
/**
|
|
625
|
+
* A street-level view: the eye `height` metres above the ground at `lon`, `lat` (degrees), looking `bearing`
|
|
626
|
+
* (degrees clockwise from north) and `pitch` (0 straight down, 90 level, 180 straight up), with a vertical field
|
|
627
|
+
* of view of `fov` degrees. A camera set with `setCamera` turns around a point again
|
|
628
|
+
* @param {number} lon
|
|
629
|
+
* @param {number} lat
|
|
630
|
+
* @param {number} height
|
|
631
|
+
* @param {number} bearing
|
|
632
|
+
* @param {number} pitch
|
|
633
|
+
* @param {number} fov
|
|
634
|
+
*/
|
|
635
|
+
setFirstPerson(lon, lat, height, bearing, pitch, fov) {
|
|
636
|
+
wasm.engine_setFirstPerson(this.__wbg_ptr, lon, lat, height, bearing, pitch, fov);
|
|
637
|
+
}
|
|
587
638
|
/**
|
|
588
639
|
* Color of the globe under the tiles (polar caps)
|
|
589
640
|
* @param {number} r
|
|
@@ -802,6 +853,22 @@ export class Engine {
|
|
|
802
853
|
setRasterStyle(id, opacity, saturation) {
|
|
803
854
|
wasm.engine_setRasterStyle(this.__wbg_ptr, id, opacity, saturation);
|
|
804
855
|
}
|
|
856
|
+
/**
|
|
857
|
+
* The headers added to the engine's requests by URL prefix (`setRequestHeaders`, the same for every map of the
|
|
858
|
+
* page): `prefixes[i]` with `counts[i]` name and value pairs, in order, flattened into `pairs`
|
|
859
|
+
* @param {string[]} prefixes
|
|
860
|
+
* @param {Uint32Array} counts
|
|
861
|
+
* @param {string[]} pairs
|
|
862
|
+
*/
|
|
863
|
+
setRequestHeaders(prefixes, counts, pairs) {
|
|
864
|
+
const ptr0 = passArrayJsValueToWasm0(prefixes, wasm.__wbindgen_malloc);
|
|
865
|
+
const len0 = WASM_VECTOR_LEN;
|
|
866
|
+
const ptr1 = passArray32ToWasm0(counts, wasm.__wbindgen_malloc);
|
|
867
|
+
const len1 = WASM_VECTOR_LEN;
|
|
868
|
+
const ptr2 = passArrayJsValueToWasm0(pairs, wasm.__wbindgen_malloc);
|
|
869
|
+
const len2 = WASM_VECTOR_LEN;
|
|
870
|
+
wasm.engine_setRequestHeaders(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
871
|
+
}
|
|
805
872
|
/**
|
|
806
873
|
* Space behind the globe (stars, atmosphere halo), in the globe projection
|
|
807
874
|
* @param {boolean} enabled
|
|
@@ -809,6 +876,18 @@ export class Engine {
|
|
|
809
876
|
setSky(enabled) {
|
|
810
877
|
wasm.engine_setSky(this.__wbg_ptr, enabled);
|
|
811
878
|
}
|
|
879
|
+
/**
|
|
880
|
+
* Shows `layers` on one side of a vertical line only, the others beneath on the other side (comparing two states
|
|
881
|
+
* of a place): left of `x` (CSS pixels from the left of the canvas), or right of it; a non-finite `x` stops
|
|
882
|
+
* @param {number} x
|
|
883
|
+
* @param {boolean} right
|
|
884
|
+
* @param {Uint32Array} layers
|
|
885
|
+
*/
|
|
886
|
+
setSwipe(x, right, layers) {
|
|
887
|
+
const ptr0 = passArray32ToWasm0(layers, wasm.__wbindgen_malloc);
|
|
888
|
+
const len0 = WASM_VECTOR_LEN;
|
|
889
|
+
wasm.engine_setSwipe(this.__wbg_ptr, x, right, ptr0, len0);
|
|
890
|
+
}
|
|
812
891
|
/**
|
|
813
892
|
* Layer-wide style of a symbol layer: size scale and opacity as zoom stops (four zooms then four values each),
|
|
814
893
|
* zoom range, visibility
|
|
@@ -1637,6 +1716,10 @@ function __wbg_get_imports() {
|
|
|
1637
1716
|
const ret = new Object();
|
|
1638
1717
|
return ret;
|
|
1639
1718
|
},
|
|
1719
|
+
__wbg_new_83ca405eae412a62: function() { return handleError(function () {
|
|
1720
|
+
const ret = new Headers();
|
|
1721
|
+
return ret;
|
|
1722
|
+
}, arguments); },
|
|
1640
1723
|
__wbg_new_ee2291f50781bf1d: function() {
|
|
1641
1724
|
const ret = new Array();
|
|
1642
1725
|
return ret;
|
|
@@ -1725,6 +1808,9 @@ function __wbg_get_imports() {
|
|
|
1725
1808
|
const ret = Reflect.set(arg0, arg1, arg2);
|
|
1726
1809
|
return ret;
|
|
1727
1810
|
}, arguments); },
|
|
1811
|
+
__wbg_set_af5932e3f78b5648: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4) {
|
|
1812
|
+
arg0.set(getStringFromWasm0(arg1, arg2), getStringFromWasm0(arg3, arg4));
|
|
1813
|
+
}, arguments); },
|
|
1728
1814
|
__wbg_set_alpha_6dea851a46253adf: function(arg0, arg1) {
|
|
1729
1815
|
arg0.alpha = arg1 !== 0;
|
|
1730
1816
|
},
|
|
@@ -1740,6 +1826,9 @@ function __wbg_get_imports() {
|
|
|
1740
1826
|
__wbg_set_depth_8b49de49803d4e60: function(arg0, arg1) {
|
|
1741
1827
|
arg0.depth = arg1 !== 0;
|
|
1742
1828
|
},
|
|
1829
|
+
__wbg_set_headers_40ad33dcf016613f: function(arg0, arg1) {
|
|
1830
|
+
arg0.headers = arg1;
|
|
1831
|
+
},
|
|
1743
1832
|
__wbg_set_power_preference_6ef22d4c8baf517f: function(arg0, arg1) {
|
|
1744
1833
|
arg0.powerPreference = __wbindgen_enum_WebGlPowerPreference[arg1];
|
|
1745
1834
|
},
|
|
@@ -2358,6 +2447,16 @@ function passArrayF64ToWasm0(arg, malloc) {
|
|
|
2358
2447
|
return ptr;
|
|
2359
2448
|
}
|
|
2360
2449
|
|
|
2450
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
2451
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
2452
|
+
for (let i = 0; i < array.length; i++) {
|
|
2453
|
+
const add = addToExternrefTable0(array[i]);
|
|
2454
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
2455
|
+
}
|
|
2456
|
+
WASM_VECTOR_LEN = array.length;
|
|
2457
|
+
return ptr;
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2361
2460
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
2362
2461
|
if (realloc === undefined) {
|
|
2363
2462
|
const buf = cachedTextEncoder.encode(arg);
|
package/dist/wmts.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* sizes), the layer's limits in it and its extent, for `addRaster({ url, grid })`.
|
|
4
4
|
*/
|
|
5
5
|
import { epsgCode, isGeographic } from "./crs.js";
|
|
6
|
+
import { withHeaders } from "./requests.js";
|
|
6
7
|
import { child, children, childText, parseXml } from "./xml.js";
|
|
7
8
|
/** Metres per degree, as WMTS counts the scale of a grid in degrees (OGC 07-057r7, 6.1) */
|
|
8
9
|
const METRES_PER_DEGREE = (2 * Math.PI * 6378137) / 360;
|
|
@@ -68,7 +69,7 @@ export function parseWmtsGrid(xml, layer, matrixSet) {
|
|
|
68
69
|
* raster's URL writes the matrix set, {z} for the matrix, {x} and {y} for the column and the row
|
|
69
70
|
*/
|
|
70
71
|
export async function wmtsGrid(capabilities, layer, matrixSet, options = {}) {
|
|
71
|
-
const response = await fetch(capabilities, options.signal ? { signal: options.signal } : {});
|
|
72
|
+
const response = await fetch(capabilities, withHeaders(capabilities, options.signal ? { signal: options.signal } : {}));
|
|
72
73
|
if (!response.ok)
|
|
73
74
|
throw new Error(`isard: ${response.status} for the WMTS capabilities`);
|
|
74
75
|
return parseWmtsGrid(await response.text(), layer, matrixSet);
|
package/dist/wmts.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wmts.js","sourceRoot":"","sources":["../src/wmts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAElD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEhE,2FAA2F;AAC3F,MAAM,iBAAiB,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,GAAG,CAAC;AACxD,0FAA0F;AAC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AC;IAC7D,MAAM,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,GAAG,EAAE,aAAa,CAAC,CAAC,CAAC;IAC7D,MAAM,MAAM,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IAC1C,OAAO;QACL,GAAG;QACH,QAAQ,EAAE,MAAM;QAChB,IAAI;QACJ,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAA0C,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACjG,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,QAAQ,CAC5B,YAA0B,EAC1B,KAAa,EACb,SAAkB,EAClB,UAAoC,EAAE;IAEtC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAC1B,YAAY,EACZ,WAAW,CAAC,YAAY,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAC5E,CAAC;IACF,IAAI,CAAC,QAAQ,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,UAAU,QAAQ,CAAC,MAAM,4BAA4B,CAAC,CAAC;IACzF,OAAO,aAAa,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;AAChE,CAAC","sourcesContent":["/**\n * The tile grid of a WMTS layer, read from the service's capabilities: its tile matrix set (CRS, levels, origin, tile\n * sizes), the layer's limits in it and its extent, for `addRaster({ url, grid })`.\n */\nimport { epsgCode, isGeographic } from './crs.ts';\nimport type { TileGrid, TileMatrix } from './grid.ts';\nimport { withHeaders } from './requests.ts';\nimport { child, children, childText, parseXml } from './xml.ts';\n\n/** Metres per degree, as WMTS counts the scale of a grid in degrees (OGC 07-057r7, 6.1) */\nconst METRES_PER_DEGREE = (2 * Math.PI * 6378137) / 360;\n/** The size of a pixel by which WMTS turns scale denominators into resolutions, metres */\nconst PIXEL = 0.00028;\n\nconst numbers = (text: string | undefined) => (text ?? '').trim().split(/\\s+/).map(Number);\n\n/**\n * The tile grid of `layer` in the capabilities document `xml`: its tile matrix set `matrixSet` (default the layer's\n * first), with the layer's tile limits and longitude-latitude extent. Throws if the layer or the set is missing\n */\nexport function parseWmtsGrid(xml: string, layer: string, matrixSet?: string): TileGrid {\n const contents = child(parseXml(xml), 'Contents');\n const entry = children(contents, 'Layer').find((l) => childText(l, 'Identifier') === layer);\n if (!entry) throw new Error(`isard: no WMTS layer ${layer}`);\n const links = children(entry, 'TileMatrixSetLink');\n const link = matrixSet === undefined ? links[0] : links.find((l) => childText(l, 'TileMatrixSet') === matrixSet);\n const name = childText(link, 'TileMatrixSet');\n const set = children(contents, 'TileMatrixSet').find((s) => childText(s, 'Identifier') === name);\n if (!name || !set) throw new Error(`isard: no tile matrix set ${matrixSet ?? ''} for the WMTS layer ${layer}`);\n const crs = childText(set, 'SupportedCRS') ?? '';\n const geographic = isGeographic(crs);\n // EPSG's geographic CRSs have their latitude first (CRS:84 and the IGN's WGS84G do not)\n const latFirst = geographic && epsgCode(crs) === 4326 && /EPSG/i.test(crs);\n const unit = geographic ? METRES_PER_DEGREE : 1;\n const limits = new Map<string, TileMatrix['limits']>();\n for (const l of children(child(link, 'TileMatrixSetLimits'), 'TileMatrixLimits')) {\n const [minRow, maxRow, minCol, maxCol] = ['MinTileRow', 'MaxTileRow', 'MinTileCol', 'MaxTileCol'].map((k) =>\n Number(childText(l, k)),\n ) as [number, number, number, number];\n limits.set(childText(l, 'TileMatrix') ?? '', [minCol, minRow, maxCol, maxRow]);\n }\n const matrices = children(set, 'TileMatrix').map((m): TileMatrix => {\n const id = childText(m, 'Identifier') ?? '';\n const [a = 0, b = 0] = numbers(childText(m, 'TopLeftCorner'));\n const limit = limits.get(id);\n return {\n id,\n resolution: (Number(childText(m, 'ScaleDenominator')) * PIXEL) / unit,\n origin: latFirst ? [b, a] : [a, b],\n tileWidth: Number(childText(m, 'TileWidth') ?? 256),\n tileHeight: Number(childText(m, 'TileHeight') ?? 256),\n matrixWidth: Number(childText(m, 'MatrixWidth') ?? Infinity),\n matrixHeight: Number(childText(m, 'MatrixHeight') ?? Infinity),\n ...(limit ? { limits: limit } : {}),\n };\n });\n // A layer's limits leave out the matrices it does not have\n const served = limits.size > 0 ? matrices.filter((m) => limits.has(String(m.id))) : matrices;\n const box = child(entry, 'WGS84BoundingBox');\n const [west, south] = numbers(childText(box, 'LowerCorner'));\n const [east, north] = numbers(childText(box, 'UpperCorner'));\n const bounds = [west, south, east, north];\n return {\n crs,\n matrices: served,\n name,\n ...(bounds.every(Number.isFinite) ? { bounds: bounds as [number, number, number, number] } : {}),\n };\n}\n\n/**\n * The tile grid of a WMTS layer, from the service's capabilities at `capabilities` (fetched with CORS), for\n * `addRaster`: `await wmtsGrid('https://…/wmts?SERVICE=WMTS&REQUEST=GetCapabilities', 'LAYER', 'MATRIXSET')`. The\n * raster's URL writes the matrix set, {z} for the matrix, {x} and {y} for the column and the row\n */\nexport async function wmtsGrid(\n capabilities: string | URL,\n layer: string,\n matrixSet?: string,\n options: { signal?: AbortSignal } = {},\n): Promise<TileGrid> {\n const response = await fetch(\n capabilities,\n withHeaders(capabilities, options.signal ? { signal: options.signal } : {}),\n );\n if (!response.ok) throw new Error(`isard: ${response.status} for the WMTS capabilities`);\n return parseWmtsGrid(await response.text(), layer, matrixSet);\n}\n"]}
|
package/package.json
CHANGED