@ogc-maps/storybook-components 0.12.2 → 0.13.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/dist/ExportButton-Ck1dESnc.js +26 -0
- package/dist/components/ExportButton/ExportButton.d.ts +8 -1
- package/dist/components/ExportButton/ExportButton.d.ts.map +1 -1
- package/dist/components/ExportButton/index.js +1 -1
- package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
- package/dist/components/LegendEditor/LegendEditor.d.ts +2 -1
- package/dist/components/LegendEditor/LegendEditor.d.ts.map +1 -1
- package/dist/{geo--Ta-t__y.js → geo-BxXVSJvJ.js} +339 -330
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +40 -39
- package/dist/hooks/useExport.d.ts +4 -3
- package/dist/hooks/useExport.d.ts.map +1 -1
- package/dist/main.js +743 -741
- package/dist/utils/exportFormats.d.ts +3 -0
- package/dist/utils/exportFormats.d.ts.map +1 -0
- package/package.json +1 -1
- package/dist/ExportButton-BsNrOvRE.js +0 -25
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useState as d, useEffect as
|
|
2
|
-
var
|
|
3
|
-
centimeters:
|
|
4
|
-
centimetres:
|
|
1
|
+
import { useState as d, useEffect as N, useCallback as v, useMemo as j } from "react";
|
|
2
|
+
var S = 63710088e-1, ne = {
|
|
3
|
+
centimeters: S * 100,
|
|
4
|
+
centimetres: S * 100,
|
|
5
5
|
degrees: 360 / (2 * Math.PI),
|
|
6
|
-
feet:
|
|
7
|
-
inches:
|
|
8
|
-
kilometers:
|
|
9
|
-
kilometres:
|
|
10
|
-
meters:
|
|
11
|
-
metres:
|
|
12
|
-
miles:
|
|
13
|
-
millimeters:
|
|
14
|
-
millimetres:
|
|
15
|
-
nauticalmiles:
|
|
6
|
+
feet: S * 3.28084,
|
|
7
|
+
inches: S * 39.37,
|
|
8
|
+
kilometers: S / 1e3,
|
|
9
|
+
kilometres: S / 1e3,
|
|
10
|
+
meters: S,
|
|
11
|
+
metres: S,
|
|
12
|
+
miles: S / 1609.344,
|
|
13
|
+
millimeters: S * 1e3,
|
|
14
|
+
millimetres: S * 1e3,
|
|
15
|
+
nauticalmiles: S / 1852,
|
|
16
16
|
radians: 1,
|
|
17
|
-
yards:
|
|
17
|
+
yards: S * 1.0936
|
|
18
18
|
};
|
|
19
19
|
function T(e, t, n = {}) {
|
|
20
20
|
const r = { type: "Feature" };
|
|
21
21
|
return (n.id === 0 || n.id) && (r.id = n.id), n.bbox && (r.bbox = n.bbox), r.properties = t || {}, r.geometry = e, r;
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function re(e, t, n = {}) {
|
|
24
24
|
for (const s of e) {
|
|
25
25
|
if (s.length < 4)
|
|
26
26
|
throw new Error(
|
|
@@ -37,7 +37,7 @@ function te(e, t, n = {}) {
|
|
|
37
37
|
coordinates: e
|
|
38
38
|
}, t, n);
|
|
39
39
|
}
|
|
40
|
-
function
|
|
40
|
+
function Q(e, t, n = {}) {
|
|
41
41
|
if (e.length < 2)
|
|
42
42
|
throw new Error("coordinates must be an array of two or more positions");
|
|
43
43
|
return T({
|
|
@@ -45,16 +45,16 @@ function z(e, t, n = {}) {
|
|
|
45
45
|
coordinates: e
|
|
46
46
|
}, t, n);
|
|
47
47
|
}
|
|
48
|
-
function
|
|
49
|
-
const n =
|
|
48
|
+
function se(e, t = "kilometers") {
|
|
49
|
+
const n = ne[t];
|
|
50
50
|
if (!n)
|
|
51
51
|
throw new Error(t + " units is invalid");
|
|
52
52
|
return e * n;
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function R(e) {
|
|
55
55
|
return e % 360 * Math.PI / 180;
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function I(e) {
|
|
58
58
|
if (!e)
|
|
59
59
|
throw new Error("coord is required");
|
|
60
60
|
if (!Array.isArray(e)) {
|
|
@@ -67,29 +67,29 @@ function x(e) {
|
|
|
67
67
|
return [...e];
|
|
68
68
|
throw new Error("coord must be GeoJSON Point or an Array of numbers");
|
|
69
69
|
}
|
|
70
|
-
function
|
|
71
|
-
var r =
|
|
72
|
-
return
|
|
70
|
+
function ie(e, t, n = {}) {
|
|
71
|
+
var r = I(e), s = I(t), i = R(s[1] - r[1]), l = R(s[0] - r[0]), o = R(r[1]), a = R(s[1]), c = Math.pow(Math.sin(i / 2), 2) + Math.pow(Math.sin(l / 2), 2) * Math.cos(o) * Math.cos(a);
|
|
72
|
+
return se(
|
|
73
73
|
2 * Math.atan2(Math.sqrt(c), Math.sqrt(1 - c)),
|
|
74
74
|
n.units
|
|
75
75
|
);
|
|
76
76
|
}
|
|
77
|
-
function
|
|
77
|
+
function B(e, t, n) {
|
|
78
78
|
if (e !== null)
|
|
79
|
-
for (var r, s, i, l, o, a, c, g = 0, f = 0, u, m = e.type, h = m === "FeatureCollection",
|
|
79
|
+
for (var r, s, i, l, o, a, c, g = 0, f = 0, u, m = e.type, h = m === "FeatureCollection", p = m === "Feature", b = h ? e.features.length : 1, y = 0; y < b; y++) {
|
|
80
80
|
c = h ? (
|
|
81
81
|
// @ts-expect-error: Known type conflict
|
|
82
|
-
e.features[
|
|
83
|
-
) :
|
|
82
|
+
e.features[y].geometry
|
|
83
|
+
) : p ? (
|
|
84
84
|
// @ts-expect-error: Known type conflict
|
|
85
85
|
e.geometry
|
|
86
86
|
) : e, u = c ? c.type === "GeometryCollection" : !1, o = u ? c.geometries.length : 1;
|
|
87
|
-
for (var
|
|
88
|
-
var
|
|
89
|
-
if (l = u ? c.geometries[
|
|
87
|
+
for (var k = 0; k < o; k++) {
|
|
88
|
+
var w = 0, M = 0;
|
|
89
|
+
if (l = u ? c.geometries[k] : c, l !== null) {
|
|
90
90
|
a = l.coordinates;
|
|
91
|
-
var
|
|
92
|
-
switch (g = 0,
|
|
91
|
+
var P = l.type;
|
|
92
|
+
switch (g = 0, P) {
|
|
93
93
|
case null:
|
|
94
94
|
break;
|
|
95
95
|
case "Point":
|
|
@@ -98,13 +98,13 @@ function V(e, t, n) {
|
|
|
98
98
|
t(
|
|
99
99
|
a,
|
|
100
100
|
f,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
101
|
+
y,
|
|
102
|
+
w,
|
|
103
|
+
M
|
|
104
104
|
) === !1
|
|
105
105
|
)
|
|
106
106
|
return !1;
|
|
107
|
-
f++,
|
|
107
|
+
f++, w++;
|
|
108
108
|
break;
|
|
109
109
|
case "LineString":
|
|
110
110
|
case "MultiPoint":
|
|
@@ -114,15 +114,15 @@ function V(e, t, n) {
|
|
|
114
114
|
t(
|
|
115
115
|
a[r],
|
|
116
116
|
f,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
117
|
+
y,
|
|
118
|
+
w,
|
|
119
|
+
M
|
|
120
120
|
) === !1
|
|
121
121
|
)
|
|
122
122
|
return !1;
|
|
123
|
-
f++,
|
|
123
|
+
f++, P === "MultiPoint" && w++;
|
|
124
124
|
}
|
|
125
|
-
|
|
125
|
+
P === "LineString" && w++;
|
|
126
126
|
break;
|
|
127
127
|
case "Polygon":
|
|
128
128
|
case "MultiLineString":
|
|
@@ -133,45 +133,45 @@ function V(e, t, n) {
|
|
|
133
133
|
t(
|
|
134
134
|
a[r][s],
|
|
135
135
|
f,
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
y,
|
|
137
|
+
w,
|
|
138
|
+
M
|
|
139
139
|
) === !1
|
|
140
140
|
)
|
|
141
141
|
return !1;
|
|
142
142
|
f++;
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
P === "MultiLineString" && w++, P === "Polygon" && M++;
|
|
145
145
|
}
|
|
146
|
-
|
|
146
|
+
P === "Polygon" && w++;
|
|
147
147
|
break;
|
|
148
148
|
case "MultiPolygon":
|
|
149
149
|
for (r = 0; r < a.length; r++) {
|
|
150
|
-
for (
|
|
150
|
+
for (M = 0, s = 0; s < a[r].length; s++) {
|
|
151
151
|
for (i = 0; i < a[r][s].length - g; i++) {
|
|
152
152
|
if (
|
|
153
153
|
// @ts-expect-error: Known type conflict
|
|
154
154
|
t(
|
|
155
155
|
a[r][s][i],
|
|
156
156
|
f,
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
157
|
+
y,
|
|
158
|
+
w,
|
|
159
|
+
M
|
|
160
160
|
) === !1
|
|
161
161
|
)
|
|
162
162
|
return !1;
|
|
163
163
|
f++;
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
M++;
|
|
166
166
|
}
|
|
167
|
-
|
|
167
|
+
w++;
|
|
168
168
|
}
|
|
169
169
|
break;
|
|
170
170
|
case "GeometryCollection":
|
|
171
171
|
for (r = 0; r < l.geometries.length; r++)
|
|
172
172
|
if (
|
|
173
173
|
// @ts-expect-error: Known type conflict
|
|
174
|
-
|
|
174
|
+
B(l.geometries[r], t) === !1
|
|
175
175
|
)
|
|
176
176
|
return !1;
|
|
177
177
|
break;
|
|
@@ -182,9 +182,9 @@ function V(e, t, n) {
|
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var n, r, s, i, l, o, a, c, g, f, u = 0, m = e.type === "FeatureCollection", h = e.type === "Feature",
|
|
187
|
-
for (n = 0; n <
|
|
185
|
+
function K(e, t) {
|
|
186
|
+
var n, r, s, i, l, o, a, c, g, f, u = 0, m = e.type === "FeatureCollection", h = e.type === "Feature", p = m ? e.features.length : 1;
|
|
187
|
+
for (n = 0; n < p; n++) {
|
|
188
188
|
for (o = m ? (
|
|
189
189
|
// @ts-expect-error: Known type conflict
|
|
190
190
|
e.features[n].geometry
|
|
@@ -267,9 +267,9 @@ function Q(e, t) {
|
|
|
267
267
|
u++;
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
|
-
function
|
|
270
|
+
function oe(e, t, n) {
|
|
271
271
|
var r = n;
|
|
272
|
-
return
|
|
272
|
+
return K(
|
|
273
273
|
e,
|
|
274
274
|
function(s, i, l, o, a) {
|
|
275
275
|
r = t(
|
|
@@ -284,8 +284,8 @@ function se(e, t, n) {
|
|
|
284
284
|
}
|
|
285
285
|
), r;
|
|
286
286
|
}
|
|
287
|
-
function
|
|
288
|
-
|
|
287
|
+
function ae(e, t) {
|
|
288
|
+
K(e, function(n, r, s, i, l) {
|
|
289
289
|
var o = n === null ? null : n.type;
|
|
290
290
|
switch (o) {
|
|
291
291
|
case null:
|
|
@@ -331,8 +331,8 @@ function ie(e, t) {
|
|
|
331
331
|
}
|
|
332
332
|
});
|
|
333
333
|
}
|
|
334
|
-
function
|
|
335
|
-
|
|
334
|
+
function le(e, t) {
|
|
335
|
+
ae(e, function(n, r, s) {
|
|
336
336
|
var i = 0;
|
|
337
337
|
if (n.geometry) {
|
|
338
338
|
var l = n.geometry.type;
|
|
@@ -340,17 +340,17 @@ function oe(e, t) {
|
|
|
340
340
|
var o, a = 0, c = 0, g = 0;
|
|
341
341
|
if (
|
|
342
342
|
// @ts-expect-error: Known type conflict
|
|
343
|
-
|
|
343
|
+
B(
|
|
344
344
|
n,
|
|
345
|
-
function(f, u, m, h,
|
|
345
|
+
function(f, u, m, h, p) {
|
|
346
346
|
if (
|
|
347
347
|
// @ts-expect-error: Known type conflict
|
|
348
|
-
o === void 0 || r > a || h > c ||
|
|
348
|
+
o === void 0 || r > a || h > c || p > g
|
|
349
349
|
) {
|
|
350
|
-
o = f, a = r, c = h, g =
|
|
350
|
+
o = f, a = r, c = h, g = p, i = 0;
|
|
351
351
|
return;
|
|
352
352
|
}
|
|
353
|
-
var
|
|
353
|
+
var b = Q(
|
|
354
354
|
// @ts-expect-error: Known type conflict
|
|
355
355
|
[o, f],
|
|
356
356
|
n.properties
|
|
@@ -359,10 +359,10 @@ function oe(e, t) {
|
|
|
359
359
|
// @ts-expect-error: Known type conflict
|
|
360
360
|
t(
|
|
361
361
|
// @ts-expect-error: Known type conflict
|
|
362
|
-
|
|
362
|
+
b,
|
|
363
363
|
r,
|
|
364
364
|
s,
|
|
365
|
-
|
|
365
|
+
p,
|
|
366
366
|
i
|
|
367
367
|
) === !1
|
|
368
368
|
)
|
|
@@ -376,9 +376,9 @@ function oe(e, t) {
|
|
|
376
376
|
}
|
|
377
377
|
});
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function ce(e, t, n) {
|
|
380
380
|
var r = n, s = !1;
|
|
381
|
-
return
|
|
381
|
+
return le(
|
|
382
382
|
e,
|
|
383
383
|
function(i, l, o, a, c) {
|
|
384
384
|
s === !1 && n === void 0 ? r = i : r = t(
|
|
@@ -393,32 +393,32 @@ function ae(e, t, n) {
|
|
|
393
393
|
}
|
|
394
394
|
), r;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
397
|
-
return
|
|
396
|
+
function ue(e, t = {}) {
|
|
397
|
+
return ce(
|
|
398
398
|
e,
|
|
399
399
|
(n, r) => {
|
|
400
400
|
const s = r.geometry.coordinates;
|
|
401
|
-
return n +
|
|
401
|
+
return n + ie(s[0], s[1], t);
|
|
402
402
|
},
|
|
403
403
|
0
|
|
404
404
|
);
|
|
405
405
|
}
|
|
406
|
-
var
|
|
407
|
-
function
|
|
408
|
-
return
|
|
406
|
+
var fe = ue;
|
|
407
|
+
function ge(e) {
|
|
408
|
+
return oe(
|
|
409
409
|
e,
|
|
410
|
-
(t, n) => t +
|
|
410
|
+
(t, n) => t + he(n),
|
|
411
411
|
0
|
|
412
412
|
);
|
|
413
413
|
}
|
|
414
|
-
function
|
|
414
|
+
function he(e) {
|
|
415
415
|
let t = 0, n;
|
|
416
416
|
switch (e.type) {
|
|
417
417
|
case "Polygon":
|
|
418
|
-
return
|
|
418
|
+
return J(e.coordinates);
|
|
419
419
|
case "MultiPolygon":
|
|
420
420
|
for (n = 0; n < e.coordinates.length; n++)
|
|
421
|
-
t +=
|
|
421
|
+
t += J(e.coordinates[n]);
|
|
422
422
|
return t;
|
|
423
423
|
case "Point":
|
|
424
424
|
case "MultiPoint":
|
|
@@ -428,31 +428,31 @@ function fe(e) {
|
|
|
428
428
|
}
|
|
429
429
|
return 0;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function J(e) {
|
|
432
432
|
let t = 0;
|
|
433
433
|
if (e && e.length > 0) {
|
|
434
|
-
t += Math.abs(
|
|
434
|
+
t += Math.abs(W(e[0]));
|
|
435
435
|
for (let n = 1; n < e.length; n++)
|
|
436
|
-
t -= Math.abs(
|
|
436
|
+
t -= Math.abs(W(e[n]));
|
|
437
437
|
}
|
|
438
438
|
return t;
|
|
439
439
|
}
|
|
440
|
-
var
|
|
441
|
-
function
|
|
440
|
+
var me = S * S / 2, U = Math.PI / 180;
|
|
441
|
+
function W(e) {
|
|
442
442
|
const t = e.length - 1;
|
|
443
443
|
if (t <= 2) return 0;
|
|
444
444
|
let n = 0, r = 0;
|
|
445
445
|
for (; r < t; ) {
|
|
446
|
-
const s = e[r], i = e[r + 1 === t ? 0 : r + 1], l = e[r + 2 >= t ? (r + 2) % t : r + 2], o = s[0] *
|
|
446
|
+
const s = e[r], i = e[r + 1 === t ? 0 : r + 1], l = e[r + 2 >= t ? (r + 2) % t : r + 2], o = s[0] * U, a = i[1] * U, c = l[0] * U;
|
|
447
447
|
n += (c - o) * Math.sin(a), r++;
|
|
448
448
|
}
|
|
449
|
-
return n *
|
|
449
|
+
return n * me;
|
|
450
450
|
}
|
|
451
|
-
var
|
|
452
|
-
const
|
|
451
|
+
var de = ge;
|
|
452
|
+
const Ie = {
|
|
453
453
|
distance: ["km", "mi", "m", "ft"],
|
|
454
454
|
area: ["km2", "mi2", "ha", "acres"]
|
|
455
|
-
},
|
|
455
|
+
}, ye = {
|
|
456
456
|
km: "km",
|
|
457
457
|
mi: "mi",
|
|
458
458
|
m: "m",
|
|
@@ -461,41 +461,41 @@ const xe = {
|
|
|
461
461
|
mi2: "mi²",
|
|
462
462
|
ha: "ha",
|
|
463
463
|
acres: "ac"
|
|
464
|
-
},
|
|
464
|
+
}, pe = {
|
|
465
465
|
km: 1,
|
|
466
466
|
mi: 0.621371,
|
|
467
467
|
m: 1e3,
|
|
468
468
|
ft: 3280.84
|
|
469
|
-
},
|
|
469
|
+
}, be = {
|
|
470
470
|
km2: 1e-6,
|
|
471
471
|
mi2: 3861e-10,
|
|
472
472
|
ha: 1e-4,
|
|
473
473
|
acres: 247105e-9
|
|
474
474
|
};
|
|
475
|
-
function
|
|
475
|
+
function Se(e, t = "km") {
|
|
476
476
|
if (e.length < 2) return 0;
|
|
477
|
-
const n =
|
|
478
|
-
return
|
|
477
|
+
const n = Q(e);
|
|
478
|
+
return fe(n, { units: "kilometers" }) * pe[t];
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function we(e, t = "km2") {
|
|
481
481
|
if (e.length < 3) return 0;
|
|
482
|
-
const n = [...e, e[0]], r =
|
|
483
|
-
return
|
|
482
|
+
const n = [...e, e[0]], r = re([n]);
|
|
483
|
+
return de(r) * be[t];
|
|
484
484
|
}
|
|
485
|
-
function
|
|
486
|
-
return e === "distance" && t.length >= 2 ? { value:
|
|
485
|
+
function Me(e, t, n) {
|
|
486
|
+
return e === "distance" && t.length >= 2 ? { value: Se(t, n), unit: n } : e === "area" && t.length >= 3 ? { value: we(t, n), unit: n } : null;
|
|
487
487
|
}
|
|
488
|
-
function
|
|
488
|
+
function ve(e) {
|
|
489
489
|
return e === "distance" ? "km" : "km2";
|
|
490
490
|
}
|
|
491
|
-
function
|
|
491
|
+
function $e(e, t) {
|
|
492
492
|
return t.length < 2 ? null : {
|
|
493
493
|
type: "Feature",
|
|
494
494
|
geometry: e === "area" && t.length >= 3 ? { type: "Polygon", coordinates: [[...t, t[0]]] } : { type: "LineString", coordinates: t },
|
|
495
495
|
properties: {}
|
|
496
496
|
};
|
|
497
497
|
}
|
|
498
|
-
function
|
|
498
|
+
function Pe(e) {
|
|
499
499
|
return e.length === 0 ? null : {
|
|
500
500
|
type: "FeatureCollection",
|
|
501
501
|
features: e.map((t) => ({
|
|
@@ -505,79 +505,79 @@ function $e(e) {
|
|
|
505
505
|
}))
|
|
506
506
|
};
|
|
507
507
|
}
|
|
508
|
-
function
|
|
509
|
-
const { value: t, unit: n } = e, r =
|
|
508
|
+
function Je(e) {
|
|
509
|
+
const { value: t, unit: n } = e, r = ye[n];
|
|
510
510
|
return t < 0.01 ? `< 0.01 ${r}` : t < 100 ? `${t.toFixed(2)} ${r}` : t < 1e4 ? `${t.toFixed(1)} ${r}` : `${t.toLocaleString(void 0, { maximumFractionDigits: 0 })} ${r}`;
|
|
511
511
|
}
|
|
512
|
-
function
|
|
512
|
+
function $(e) {
|
|
513
513
|
return e.endsWith("/") ? e.slice(0, -1) : e;
|
|
514
514
|
}
|
|
515
|
-
async function
|
|
515
|
+
async function C(e) {
|
|
516
516
|
const t = await fetch(e);
|
|
517
517
|
if (!t.ok)
|
|
518
518
|
throw new Error(`OGC API request failed: ${t.status} ${t.statusText} (${e})`);
|
|
519
519
|
return t.json();
|
|
520
520
|
}
|
|
521
|
-
async function
|
|
522
|
-
const t = `${
|
|
523
|
-
return (await
|
|
521
|
+
async function Ce(e) {
|
|
522
|
+
const t = `${$(e)}/collections?f=json`;
|
|
523
|
+
return (await C(t)).collections;
|
|
524
524
|
}
|
|
525
|
-
async function
|
|
525
|
+
async function L(e, t, n = {}) {
|
|
526
526
|
var l;
|
|
527
|
-
const r =
|
|
527
|
+
const r = $(e), s = new URLSearchParams({ f: "geojson" });
|
|
528
528
|
if (n.limit != null && s.set("limit", String(n.limit)), n.offset != null && s.set("offset", String(n.offset)), n.bbox && s.set("bbox", n.bbox.join(",")), (l = n.properties) != null && l.length && s.set("properties", n.properties.join(",")), n.datetime && s.set("datetime", n.datetime), n.cql2Filter)
|
|
529
529
|
s.set("filter-lang", "cql2-json"), s.set("filter", JSON.stringify(n.cql2Filter));
|
|
530
530
|
else if (n.filter)
|
|
531
531
|
for (const [o, a] of Object.entries(n.filter))
|
|
532
532
|
s.set(o, String(a));
|
|
533
533
|
const i = `${r}/collections/${encodeURIComponent(t)}/items?${s}`;
|
|
534
|
-
return
|
|
534
|
+
return C(i);
|
|
535
535
|
}
|
|
536
|
-
async function
|
|
537
|
-
const s = `${
|
|
536
|
+
async function We(e, t, n) {
|
|
537
|
+
const s = `${$(e)}/collections/${encodeURIComponent(t)}/items/${encodeURIComponent(String(n))}?f=geojson`;
|
|
538
538
|
try {
|
|
539
|
-
return await
|
|
539
|
+
return await C(s);
|
|
540
540
|
} catch {
|
|
541
541
|
return null;
|
|
542
542
|
}
|
|
543
543
|
}
|
|
544
|
-
async function
|
|
545
|
-
const r = `${
|
|
546
|
-
return
|
|
544
|
+
async function ke(e, t) {
|
|
545
|
+
const r = `${$(e)}/collections/${encodeURIComponent(t)}/queryables?f=schemajson`;
|
|
546
|
+
return C(r);
|
|
547
547
|
}
|
|
548
|
-
async function
|
|
549
|
-
const r = `${
|
|
550
|
-
return
|
|
548
|
+
async function Le(e, t) {
|
|
549
|
+
const r = `${$(e)}/collections/${encodeURIComponent(t)}?f=json`;
|
|
550
|
+
return C(r);
|
|
551
551
|
}
|
|
552
|
-
async function
|
|
553
|
-
const t = `${
|
|
554
|
-
return
|
|
552
|
+
async function ze(e) {
|
|
553
|
+
const t = `${$(e)}/conformance?f=json`;
|
|
554
|
+
return C(t);
|
|
555
555
|
}
|
|
556
|
-
async function
|
|
557
|
-
const r =
|
|
558
|
-
return
|
|
556
|
+
async function Ve(e, t, n = "WebMercatorQuad") {
|
|
557
|
+
const r = Ee(e, t, n);
|
|
558
|
+
return C(r);
|
|
559
559
|
}
|
|
560
|
-
async function
|
|
561
|
-
return (await
|
|
560
|
+
async function Qe(e, t, n = {}) {
|
|
561
|
+
return (await L(e, t, {
|
|
562
562
|
...n,
|
|
563
563
|
limit: 0
|
|
564
564
|
})).numberMatched ?? null;
|
|
565
565
|
}
|
|
566
|
-
function
|
|
567
|
-
return `${
|
|
566
|
+
function Ee(e, t, n = "WebMercatorQuad") {
|
|
567
|
+
return `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/tilejson.json`;
|
|
568
568
|
}
|
|
569
|
-
function
|
|
570
|
-
return `${
|
|
569
|
+
function Be(e, t, n = "WebMercatorQuad") {
|
|
570
|
+
return `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(n)}/{z}/{x}/{y}`;
|
|
571
571
|
}
|
|
572
|
-
function
|
|
573
|
-
const i = `${
|
|
572
|
+
function Ke(e, t, n, r = "WebMercatorQuad") {
|
|
573
|
+
const i = `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
|
|
574
574
|
if (!n || Object.keys(n).length === 0) return i;
|
|
575
575
|
const l = new URLSearchParams();
|
|
576
576
|
for (const [o, a] of Object.entries(n))
|
|
577
577
|
l.set(o, String(a));
|
|
578
578
|
return `${i}?${l}`;
|
|
579
579
|
}
|
|
580
|
-
async function
|
|
580
|
+
async function Xe(e, t, n, r) {
|
|
581
581
|
const s = r != null && r.query ? { op: "like", args: [{ property: n }, `%${r.query}%`] } : void 0, i = /* @__PURE__ */ new Set(), l = (o) => {
|
|
582
582
|
var a;
|
|
583
583
|
for (const c of o) {
|
|
@@ -589,7 +589,7 @@ async function Be(e, t, n, r) {
|
|
|
589
589
|
const o = r.maxFeatures ?? 1e4, a = r.limit ?? 500;
|
|
590
590
|
let c = 0, g = 0;
|
|
591
591
|
for (; g < o; ) {
|
|
592
|
-
const f = Math.min(a, o - g), u = await
|
|
592
|
+
const f = Math.min(a, o - g), u = await L(e, t, {
|
|
593
593
|
properties: [n],
|
|
594
594
|
limit: f,
|
|
595
595
|
offset: c,
|
|
@@ -598,7 +598,7 @@ async function Be(e, t, n, r) {
|
|
|
598
598
|
if (l(u.features), g += u.features.length, c += u.features.length, u.features.length < f || u.numberMatched != null && c >= u.numberMatched) break;
|
|
599
599
|
}
|
|
600
600
|
} else {
|
|
601
|
-
const o = await
|
|
601
|
+
const o = await L(e, t, {
|
|
602
602
|
properties: [n],
|
|
603
603
|
limit: (r == null ? void 0 : r.limit) ?? 50,
|
|
604
604
|
cql2Filter: s
|
|
@@ -607,8 +607,8 @@ async function Be(e, t, n, r) {
|
|
|
607
607
|
}
|
|
608
608
|
return Array.from(i).sort();
|
|
609
609
|
}
|
|
610
|
-
function
|
|
611
|
-
const i = `${
|
|
610
|
+
function Ye(e, t, n, r = "WebMercatorQuad") {
|
|
611
|
+
const i = `${$(e)}/collections/${encodeURIComponent(t)}/tiles/${encodeURIComponent(r)}/{z}/{x}/{y}`;
|
|
612
612
|
if (!n) return i;
|
|
613
613
|
const l = new URLSearchParams({
|
|
614
614
|
"filter-lang": "cql2-json",
|
|
@@ -616,18 +616,18 @@ function Ke(e, t, n, r = "WebMercatorQuad") {
|
|
|
616
616
|
});
|
|
617
617
|
return `${i}?${l}`;
|
|
618
618
|
}
|
|
619
|
-
function
|
|
619
|
+
function He(e, t) {
|
|
620
620
|
return t ? `${e}--${JSON.stringify(t)}` : e;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function Ze(e) {
|
|
623
623
|
return e.length === 1 ? ["==", ["geometry-type"], e[0]] : ["in", ["geometry-type"], ["literal", e]];
|
|
624
624
|
}
|
|
625
|
-
function
|
|
625
|
+
function et(e) {
|
|
626
626
|
const [t, n] = d([]), [r, s] = d(!1), [i, l] = d(null);
|
|
627
|
-
return
|
|
627
|
+
return N(() => {
|
|
628
628
|
if (!e) return;
|
|
629
629
|
let o = !1;
|
|
630
|
-
return s(!0), l(null),
|
|
630
|
+
return s(!0), l(null), Ce(e).then((a) => {
|
|
631
631
|
o || n(a);
|
|
632
632
|
}).catch((a) => {
|
|
633
633
|
o || l(a instanceof Error ? a : new Error(String(a)));
|
|
@@ -638,12 +638,12 @@ function He(e) {
|
|
|
638
638
|
};
|
|
639
639
|
}, [e]), { collections: t, loading: r, error: i };
|
|
640
640
|
}
|
|
641
|
-
function
|
|
641
|
+
function tt(e, t) {
|
|
642
642
|
const [n, r] = d(null), [s, i] = d(!1), [l, o] = d(null);
|
|
643
|
-
return
|
|
643
|
+
return N(() => {
|
|
644
644
|
if (!e || !t) return;
|
|
645
645
|
let a = !1;
|
|
646
|
-
return i(!0), o(null),
|
|
646
|
+
return i(!0), o(null), ke(e, t).then((c) => {
|
|
647
647
|
a || r(c);
|
|
648
648
|
}).catch((c) => {
|
|
649
649
|
a || o(c instanceof Error ? c : new Error(String(c)));
|
|
@@ -654,18 +654,18 @@ function Ze(e, t) {
|
|
|
654
654
|
};
|
|
655
655
|
}, [e, t]), { queryables: n, loading: s, error: l };
|
|
656
656
|
}
|
|
657
|
-
function
|
|
657
|
+
function nt(e, t, n = {}) {
|
|
658
658
|
const [r, s] = d([]), [i, l] = d(!1), [o, a] = d(null), [c, g] = d(!1), f = JSON.stringify(n);
|
|
659
|
-
return
|
|
659
|
+
return N(() => {
|
|
660
660
|
if (!e || !t) return;
|
|
661
661
|
let u = !1;
|
|
662
662
|
l(!0), a(null);
|
|
663
663
|
const m = JSON.parse(f);
|
|
664
|
-
return
|
|
664
|
+
return L(e, t, m).then((h) => {
|
|
665
665
|
if (!u) {
|
|
666
666
|
s(h.features);
|
|
667
|
-
const
|
|
668
|
-
h.numberMatched != null ? g(
|
|
667
|
+
const p = m.limit ?? 10, b = m.offset ?? 0;
|
|
668
|
+
h.numberMatched != null ? g(b + h.features.length < h.numberMatched) : g(h.features.length >= p);
|
|
669
669
|
}
|
|
670
670
|
}).catch((h) => {
|
|
671
671
|
u || (a(h instanceof Error ? h : new Error(String(h))), s([]), g(!1));
|
|
@@ -676,83 +676,83 @@ function et(e, t, n = {}) {
|
|
|
676
676
|
};
|
|
677
677
|
}, [e, t, f]), { features: r, loading: i, error: o, hasMore: c };
|
|
678
678
|
}
|
|
679
|
-
function
|
|
679
|
+
function _(e) {
|
|
680
680
|
return `${e[0]} ${e[1]}`;
|
|
681
681
|
}
|
|
682
|
-
function
|
|
683
|
-
return e.map(
|
|
682
|
+
function A(e) {
|
|
683
|
+
return e.map(_).join(", ");
|
|
684
684
|
}
|
|
685
|
-
function
|
|
685
|
+
function X(e) {
|
|
686
686
|
if (!e || !e.type) return "";
|
|
687
687
|
switch (e.type) {
|
|
688
688
|
case "Point":
|
|
689
|
-
return `POINT (${
|
|
689
|
+
return `POINT (${_(e.coordinates)})`;
|
|
690
690
|
case "MultiPoint":
|
|
691
|
-
return `MULTIPOINT (${e.coordinates.map((t) => `(${
|
|
691
|
+
return `MULTIPOINT (${e.coordinates.map((t) => `(${_(t)})`).join(", ")})`;
|
|
692
692
|
case "LineString":
|
|
693
|
-
return `LINESTRING (${
|
|
693
|
+
return `LINESTRING (${A(e.coordinates)})`;
|
|
694
694
|
case "MultiLineString":
|
|
695
|
-
return `MULTILINESTRING (${e.coordinates.map((t) => `(${
|
|
695
|
+
return `MULTILINESTRING (${e.coordinates.map((t) => `(${A(t)})`).join(", ")})`;
|
|
696
696
|
case "Polygon":
|
|
697
|
-
return `POLYGON (${e.coordinates.map((t) => `(${
|
|
697
|
+
return `POLYGON (${e.coordinates.map((t) => `(${A(t)})`).join(", ")})`;
|
|
698
698
|
case "MultiPolygon":
|
|
699
|
-
return `MULTIPOLYGON (${e.coordinates.map((t) => `(${t.map((n) => `(${
|
|
699
|
+
return `MULTIPOLYGON (${e.coordinates.map((t) => `(${t.map((n) => `(${A(n)})`).join(", ")})`).join(", ")})`;
|
|
700
700
|
case "GeometryCollection":
|
|
701
|
-
return `GEOMETRYCOLLECTION (${e.geometries.map(
|
|
701
|
+
return `GEOMETRYCOLLECTION (${e.geometries.map(X).join(", ")})`;
|
|
702
702
|
default:
|
|
703
703
|
return "";
|
|
704
704
|
}
|
|
705
705
|
}
|
|
706
|
-
function
|
|
706
|
+
function Y(e, t) {
|
|
707
707
|
const n = URL.createObjectURL(e), r = document.createElement("a");
|
|
708
708
|
r.href = n, r.download = t, r.style.display = "none", document.body.appendChild(r), r.click(), document.body.removeChild(r), URL.revokeObjectURL(n);
|
|
709
709
|
}
|
|
710
|
-
function
|
|
710
|
+
function x(e, t) {
|
|
711
711
|
return e.includes('"') || e.includes(t) || e.includes(`
|
|
712
712
|
`) ? `"${e.replace(/"/g, '""')}"` : e;
|
|
713
713
|
}
|
|
714
|
-
function
|
|
714
|
+
function Oe(e, t) {
|
|
715
715
|
const n = (e.properties ?? {})[t];
|
|
716
716
|
return n == null ? "" : typeof n == "object" ? JSON.stringify(n) : String(n);
|
|
717
717
|
}
|
|
718
|
-
function
|
|
718
|
+
function Fe(e, t = {}) {
|
|
719
719
|
const { fields: n, includeGeometry: r = !0, delimiter: s = "," } = t;
|
|
720
720
|
if (e.length === 0) return "";
|
|
721
721
|
const i = n ?? [...new Set(e.flatMap((a) => Object.keys(a.properties ?? {})))], l = r ? [...i, "geometry"] : i, o = e.map((a) => {
|
|
722
722
|
const c = i.map(
|
|
723
|
-
(g) =>
|
|
723
|
+
(g) => x(Oe(a, g), s)
|
|
724
724
|
);
|
|
725
|
-
return r && c.push(
|
|
725
|
+
return r && c.push(x(X(a.geometry), s)), c.join(s);
|
|
726
726
|
});
|
|
727
|
-
return [l.map((a) =>
|
|
727
|
+
return [l.map((a) => x(a, s)).join(s), ...o].join(`
|
|
728
728
|
`);
|
|
729
729
|
}
|
|
730
|
-
function
|
|
730
|
+
function Re(e, t) {
|
|
731
731
|
const n = new Blob([e], { type: "text/csv;charset=utf-8;" });
|
|
732
|
-
|
|
732
|
+
Y(n, t);
|
|
733
733
|
}
|
|
734
|
-
function
|
|
734
|
+
function rt({
|
|
735
735
|
baseUrl: e,
|
|
736
736
|
limit: t = 1e3,
|
|
737
737
|
csvOptions: n
|
|
738
738
|
}) {
|
|
739
739
|
const [r, s] = d(!1), [i, l] = d(null);
|
|
740
|
-
return { exportCsv:
|
|
740
|
+
return { exportCsv: v(
|
|
741
741
|
async (a, c = `${a}.csv`, g) => {
|
|
742
742
|
s(!0), l(null);
|
|
743
743
|
const f = [], u = Math.min(t, 1e3);
|
|
744
744
|
let m = 0;
|
|
745
745
|
try {
|
|
746
746
|
for (; f.length < t; ) {
|
|
747
|
-
const
|
|
748
|
-
limit:
|
|
747
|
+
const p = t - f.length, b = Math.min(u, p), y = await L(e, a, {
|
|
748
|
+
limit: b,
|
|
749
749
|
offset: m,
|
|
750
750
|
cql2Filter: g
|
|
751
751
|
});
|
|
752
|
-
if (f.push(...
|
|
752
|
+
if (f.push(...y.features), m += y.features.length, y.features.length < b || y.numberMatched != null && m >= y.numberMatched) break;
|
|
753
753
|
}
|
|
754
|
-
const h =
|
|
755
|
-
|
|
754
|
+
const h = Fe(f, n);
|
|
755
|
+
Re(h, c);
|
|
756
756
|
} catch (h) {
|
|
757
757
|
l(h instanceof Error ? h : new Error(String(h)));
|
|
758
758
|
} finally {
|
|
@@ -762,38 +762,38 @@ function tt({
|
|
|
762
762
|
[e, t, n]
|
|
763
763
|
), loading: r, error: i };
|
|
764
764
|
}
|
|
765
|
-
function
|
|
766
|
-
baseUrl: e,
|
|
765
|
+
function st({
|
|
766
|
+
baseUrl: e = "",
|
|
767
767
|
limit: t = 1e5,
|
|
768
768
|
converters: n
|
|
769
769
|
}) {
|
|
770
770
|
const [r, s] = d(!1), [i, l] = d(null), [o, a] = d(null);
|
|
771
|
-
return { runExport:
|
|
772
|
-
async (g, f, u, m) => {
|
|
773
|
-
const h = n[f];
|
|
774
|
-
if (!
|
|
771
|
+
return { runExport: v(
|
|
772
|
+
async (g, f, u, m, h) => {
|
|
773
|
+
const p = h ?? e, b = n[f];
|
|
774
|
+
if (!b) {
|
|
775
775
|
a(new Error(`Unknown export format: ${f}`));
|
|
776
776
|
return;
|
|
777
777
|
}
|
|
778
778
|
s(!0), l("Fetching features..."), a(null);
|
|
779
|
-
const y = [],
|
|
780
|
-
let
|
|
779
|
+
const y = [], k = Math.min(t, 1e3);
|
|
780
|
+
let w = 0;
|
|
781
781
|
try {
|
|
782
782
|
for (; y.length < t; ) {
|
|
783
|
-
const
|
|
784
|
-
limit:
|
|
785
|
-
offset:
|
|
783
|
+
const P = t - y.length, q = Math.min(k, P), O = await L(p, g, {
|
|
784
|
+
limit: q,
|
|
785
|
+
offset: w,
|
|
786
786
|
cql2Filter: m
|
|
787
787
|
});
|
|
788
|
-
y.push(...
|
|
789
|
-
const
|
|
790
|
-
if (
|
|
788
|
+
y.push(...O.features), w += O.features.length;
|
|
789
|
+
const F = O.numberMatched;
|
|
790
|
+
if (F != null ? l(`Fetching features... (${y.length} of ${F})`) : l(`Fetching features... (${y.length})`), O.features.length < q || F != null && w >= F) break;
|
|
791
791
|
}
|
|
792
792
|
l("Converting...");
|
|
793
|
-
const
|
|
794
|
-
|
|
795
|
-
} catch (
|
|
796
|
-
a(
|
|
793
|
+
const M = await b(y, g);
|
|
794
|
+
Y(M.blob, u);
|
|
795
|
+
} catch (M) {
|
|
796
|
+
a(M instanceof Error ? M : new Error(String(M)));
|
|
797
797
|
} finally {
|
|
798
798
|
s(!1), l(null);
|
|
799
799
|
}
|
|
@@ -801,12 +801,20 @@ function nt({
|
|
|
801
801
|
[e, t, n]
|
|
802
802
|
), loading: r, progress: i, error: o };
|
|
803
803
|
}
|
|
804
|
-
|
|
804
|
+
const it = [
|
|
805
|
+
{ id: "csv", label: "CSV", extension: ".csv", description: "Comma-separated values" },
|
|
806
|
+
{ id: "geojson", label: "GeoJSON", extension: ".geojson", description: "GeoJSON format" },
|
|
807
|
+
{ id: "kml", label: "KML", extension: ".kml", description: "Google Earth" },
|
|
808
|
+
{ id: "shapefile", label: "Shapefile", extension: ".zip", description: "Esri Shapefile" },
|
|
809
|
+
{ id: "flatgeobuf", label: "FlatGeobuf", extension: ".fgb", description: "FlatGeobuf" },
|
|
810
|
+
{ id: "geopackage", label: "GeoPackage", extension: ".gpkg", description: "OGC GeoPackage" }
|
|
811
|
+
];
|
|
812
|
+
function ot(e, t) {
|
|
805
813
|
const [n, r] = d(null), [s, i] = d(!1), [l, o] = d(null);
|
|
806
|
-
return
|
|
814
|
+
return N(() => {
|
|
807
815
|
if (!e || !t) return;
|
|
808
816
|
let a = !1;
|
|
809
|
-
return i(!0), o(null),
|
|
817
|
+
return i(!0), o(null), Le(e, t).then((c) => {
|
|
810
818
|
a || r(c);
|
|
811
819
|
}).catch((c) => {
|
|
812
820
|
a || o(c instanceof Error ? c : new Error(String(c)));
|
|
@@ -817,30 +825,30 @@ function rt(e, t) {
|
|
|
817
825
|
};
|
|
818
826
|
}, [e, t]), { collection: n, loading: s, error: l };
|
|
819
827
|
}
|
|
820
|
-
function
|
|
828
|
+
function at() {
|
|
821
829
|
const [e, t] = d(null), [n, r] = d([]), [s, i] = d("km"), l = j(
|
|
822
|
-
() => e ?
|
|
830
|
+
() => e ? Me(e, n, s) : null,
|
|
823
831
|
[e, n, s]
|
|
824
832
|
), o = j(
|
|
825
|
-
() => e ?
|
|
833
|
+
() => e ? $e(e, n) : null,
|
|
826
834
|
[e, n]
|
|
827
835
|
), a = j(
|
|
828
|
-
() => e ?
|
|
836
|
+
() => e ? Pe(n) : null,
|
|
829
837
|
[e, n]
|
|
830
|
-
), c =
|
|
831
|
-
t(u), r([]), u && i(
|
|
832
|
-
}, []), g =
|
|
838
|
+
), c = v((u) => {
|
|
839
|
+
t(u), r([]), u && i(ve(u));
|
|
840
|
+
}, []), g = v((u) => {
|
|
833
841
|
r((m) => [...m, u]);
|
|
834
|
-
}, []), f =
|
|
842
|
+
}, []), f = v(() => {
|
|
835
843
|
r([]);
|
|
836
844
|
}, []);
|
|
837
845
|
return { mode: e, points: n, unit: s, measurement: l, geometryData: o, pointsData: a, setMode: c, setUnit: i, addPoint: g, clear: f };
|
|
838
846
|
}
|
|
839
|
-
function
|
|
847
|
+
function D(e) {
|
|
840
848
|
return e.id != null ? `${e.layerId}:${e.id}` : `${e.layerId}:${JSON.stringify(e.properties)}`;
|
|
841
849
|
}
|
|
842
|
-
const
|
|
843
|
-
function
|
|
850
|
+
const z = 1e3;
|
|
851
|
+
function lt() {
|
|
844
852
|
const [e, t] = d(null), [n, r] = d(null), [s, i] = d([]), l = j(() => s.length === 0 ? null : {
|
|
845
853
|
type: "FeatureCollection",
|
|
846
854
|
features: s.map((u) => ({
|
|
@@ -848,18 +856,18 @@ function it() {
|
|
|
848
856
|
properties: u.properties,
|
|
849
857
|
geometry: u.geometry
|
|
850
858
|
}))
|
|
851
|
-
}, [s]), o =
|
|
859
|
+
}, [s]), o = v((u) => {
|
|
852
860
|
t(u);
|
|
853
|
-
}, []), a =
|
|
861
|
+
}, []), a = v((u) => {
|
|
854
862
|
r(u), i([]);
|
|
855
|
-
}, []), c =
|
|
863
|
+
}, []), c = v((u) => {
|
|
856
864
|
i((m) => {
|
|
857
|
-
const h = new Set(m.map(
|
|
858
|
-
return
|
|
865
|
+
const h = new Set(m.map(D)), p = u.filter((y) => !h.has(D(y))), b = [...m, ...p];
|
|
866
|
+
return b.length > z ? b.slice(0, z) : b;
|
|
859
867
|
});
|
|
860
|
-
}, []), g =
|
|
861
|
-
i((m) => m.filter((h) =>
|
|
862
|
-
}, []), f =
|
|
868
|
+
}, []), g = v((u) => {
|
|
869
|
+
i((m) => m.filter((h) => D(h) !== u));
|
|
870
|
+
}, []), f = v(() => {
|
|
863
871
|
i([]);
|
|
864
872
|
}, []);
|
|
865
873
|
return {
|
|
@@ -874,14 +882,14 @@ function it() {
|
|
|
874
882
|
clearFeatures: f
|
|
875
883
|
};
|
|
876
884
|
}
|
|
877
|
-
function
|
|
885
|
+
function ct(e) {
|
|
878
886
|
if (!e) return;
|
|
879
887
|
const t = [], n = {};
|
|
880
888
|
for (const [r, s] of Object.entries(e))
|
|
881
889
|
s.visible !== !1 && (t.push(r), s.label && (n[r] = s.label));
|
|
882
890
|
return { fields: t, labels: n };
|
|
883
891
|
}
|
|
884
|
-
async function
|
|
892
|
+
async function ut(e) {
|
|
885
893
|
try {
|
|
886
894
|
const t = await fetch(e);
|
|
887
895
|
if (!t.ok) return null;
|
|
@@ -891,7 +899,7 @@ async function at(e) {
|
|
|
891
899
|
return null;
|
|
892
900
|
}
|
|
893
901
|
}
|
|
894
|
-
async function
|
|
902
|
+
async function Ae(e) {
|
|
895
903
|
try {
|
|
896
904
|
const t = await fetch(`${e}.json`);
|
|
897
905
|
if (!t.ok) return [];
|
|
@@ -901,7 +909,7 @@ async function Fe(e) {
|
|
|
901
909
|
return [];
|
|
902
910
|
}
|
|
903
911
|
}
|
|
904
|
-
async function
|
|
912
|
+
async function ft(e, t) {
|
|
905
913
|
const n = await fetch(e);
|
|
906
914
|
if (!n.ok) throw new Error(`Failed to fetch style: ${n.status}`);
|
|
907
915
|
const r = await n.json();
|
|
@@ -912,7 +920,7 @@ async function lt(e, t) {
|
|
|
912
920
|
];
|
|
913
921
|
return { ...r, sprite: l };
|
|
914
922
|
}
|
|
915
|
-
async function
|
|
923
|
+
async function Ge(e) {
|
|
916
924
|
try {
|
|
917
925
|
const t = await fetch(e);
|
|
918
926
|
if (!t.ok) return [];
|
|
@@ -922,87 +930,87 @@ async function Re(e) {
|
|
|
922
930
|
return [];
|
|
923
931
|
}
|
|
924
932
|
}
|
|
925
|
-
async function
|
|
926
|
-
const t = await
|
|
933
|
+
async function V(e) {
|
|
934
|
+
const t = await Ae(e.url);
|
|
927
935
|
return e.id === "default" ? t : t.map((n) => `${e.id}:${n}`);
|
|
928
936
|
}
|
|
929
|
-
async function
|
|
937
|
+
async function gt(e, t = []) {
|
|
930
938
|
const n = [];
|
|
931
939
|
e && n.push(
|
|
932
|
-
|
|
933
|
-
(s) => Promise.all(s.map(
|
|
940
|
+
Ge(e).then(
|
|
941
|
+
(s) => Promise.all(s.map(V)).then((i) => i.flat())
|
|
934
942
|
)
|
|
935
943
|
);
|
|
936
944
|
for (const s of t)
|
|
937
|
-
n.push(
|
|
945
|
+
n.push(V(s));
|
|
938
946
|
const r = await Promise.all(n);
|
|
939
947
|
return [...new Set(r.flat())].sort();
|
|
940
948
|
}
|
|
941
949
|
function E(e, t) {
|
|
942
950
|
return { op: "=", args: [{ property: e }, t] };
|
|
943
951
|
}
|
|
944
|
-
function
|
|
952
|
+
function ht(e, t) {
|
|
945
953
|
return { op: "<>", args: [{ property: e }, t] };
|
|
946
954
|
}
|
|
947
|
-
function
|
|
955
|
+
function je(e, t) {
|
|
948
956
|
return { op: ">", args: [{ property: e }, t] };
|
|
949
957
|
}
|
|
950
|
-
function
|
|
958
|
+
function H(e, t) {
|
|
951
959
|
return { op: ">=", args: [{ property: e }, t] };
|
|
952
960
|
}
|
|
953
|
-
function
|
|
961
|
+
function Te(e, t) {
|
|
954
962
|
return { op: "<", args: [{ property: e }, t] };
|
|
955
963
|
}
|
|
956
|
-
function
|
|
964
|
+
function Z(e, t) {
|
|
957
965
|
return { op: "<=", args: [{ property: e }, t] };
|
|
958
966
|
}
|
|
959
|
-
function
|
|
960
|
-
return { op: "and", args: [
|
|
967
|
+
function Ne(e, t, n) {
|
|
968
|
+
return { op: "and", args: [H(e, t), Z(e, n)] };
|
|
961
969
|
}
|
|
962
|
-
function
|
|
970
|
+
function mt(e, t) {
|
|
963
971
|
return { op: "like", args: [{ property: e }, t] };
|
|
964
972
|
}
|
|
965
|
-
function
|
|
973
|
+
function dt(e, t) {
|
|
966
974
|
return { op: "in", args: [{ property: e }, t] };
|
|
967
975
|
}
|
|
968
|
-
function
|
|
976
|
+
function yt(e) {
|
|
969
977
|
return { op: "isNull", args: [{ property: e }] };
|
|
970
978
|
}
|
|
971
|
-
function
|
|
979
|
+
function ee(...e) {
|
|
972
980
|
const t = e.filter((n) => n != null);
|
|
973
981
|
return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "and", args: t };
|
|
974
982
|
}
|
|
975
|
-
function
|
|
983
|
+
function pt(...e) {
|
|
976
984
|
const t = e.filter((n) => n != null);
|
|
977
985
|
return t.length === 0 ? null : t.length === 1 ? t[0] : { op: "or", args: t };
|
|
978
986
|
}
|
|
979
|
-
function
|
|
987
|
+
function bt(e) {
|
|
980
988
|
return { op: "not", args: [e] };
|
|
981
989
|
}
|
|
982
|
-
function
|
|
990
|
+
function Ue(e, t) {
|
|
983
991
|
return { op: "t_after", args: [{ property: e }, t] };
|
|
984
992
|
}
|
|
985
|
-
function
|
|
993
|
+
function xe(e, t) {
|
|
986
994
|
return { op: "t_before", args: [{ property: e }, t] };
|
|
987
995
|
}
|
|
988
|
-
function
|
|
996
|
+
function De(e, t, n) {
|
|
989
997
|
const r = "date" in t ? t.date : t.timestamp, s = "date" in n ? n.date : n.timestamp;
|
|
990
998
|
return { op: "t_during", args: [{ property: e }, { interval: [r, s] }] };
|
|
991
999
|
}
|
|
992
|
-
function
|
|
1000
|
+
function St(e, t) {
|
|
993
1001
|
return { op: "s_intersects", args: [{ property: e }, t] };
|
|
994
1002
|
}
|
|
995
|
-
function
|
|
1003
|
+
function wt(e, t) {
|
|
996
1004
|
return { op: "s_within", args: [{ property: e }, t] };
|
|
997
1005
|
}
|
|
998
|
-
function
|
|
1006
|
+
function Mt(e, t, n, r = "meters") {
|
|
999
1007
|
return { op: "s_dwithin", args: [{ property: e }, t, n, r] };
|
|
1000
1008
|
}
|
|
1001
|
-
function
|
|
1009
|
+
function vt(e) {
|
|
1002
1010
|
const t = Object.entries(e).filter(([, n]) => n !== void 0 && n !== "").map(([n, r]) => E(n, r));
|
|
1003
|
-
return
|
|
1011
|
+
return ee(...t);
|
|
1004
1012
|
}
|
|
1005
|
-
function
|
|
1013
|
+
function $t(e, t) {
|
|
1006
1014
|
const n = new Map(t.map((s) => [s.property, s])), r = Object.entries(e).map(([s, i]) => {
|
|
1007
1015
|
if (i === void 0) return null;
|
|
1008
1016
|
const l = n.get(s);
|
|
@@ -1013,112 +1021,113 @@ function St(e, t) {
|
|
|
1013
1021
|
if (typeof i == "object") {
|
|
1014
1022
|
if ("start" in i || "end" in i) {
|
|
1015
1023
|
const { start: o, end: a } = i;
|
|
1016
|
-
return o && a ?
|
|
1024
|
+
return o && a ? De(s, { timestamp: o }, { timestamp: a }) : o ? Ue(s, { timestamp: o }) : a ? xe(s, { timestamp: a }) : null;
|
|
1017
1025
|
}
|
|
1018
1026
|
if ("value" in i && "operator" in i) {
|
|
1019
1027
|
const { value: o, operator: a } = i;
|
|
1020
1028
|
if (o == null || String(o) === "") return null;
|
|
1021
1029
|
switch (a) {
|
|
1022
1030
|
case "gt":
|
|
1023
|
-
return Ae(s, o);
|
|
1024
|
-
case "lt":
|
|
1025
1031
|
return je(s, o);
|
|
1032
|
+
case "lt":
|
|
1033
|
+
return Te(s, o);
|
|
1026
1034
|
case "gte":
|
|
1027
|
-
return
|
|
1035
|
+
return H(s, o);
|
|
1028
1036
|
case "lte":
|
|
1029
|
-
return
|
|
1037
|
+
return Z(s, o);
|
|
1030
1038
|
default:
|
|
1031
1039
|
return E(s, o);
|
|
1032
1040
|
}
|
|
1033
1041
|
}
|
|
1034
1042
|
if ("min" in i && "max" in i) {
|
|
1035
1043
|
const { min: o, max: a } = i;
|
|
1036
|
-
return o === void 0 || a === void 0 ? null :
|
|
1044
|
+
return o === void 0 || a === void 0 ? null : Ne(s, o, a);
|
|
1037
1045
|
}
|
|
1038
1046
|
}
|
|
1039
1047
|
return null;
|
|
1040
1048
|
});
|
|
1041
|
-
return
|
|
1049
|
+
return ee(...r);
|
|
1042
1050
|
}
|
|
1043
|
-
function
|
|
1051
|
+
function Pt(e) {
|
|
1044
1052
|
return JSON.stringify(e);
|
|
1045
1053
|
}
|
|
1046
|
-
function
|
|
1054
|
+
function te(e) {
|
|
1047
1055
|
const t = e.type, n = e.coordinates;
|
|
1048
|
-
return t === "Point" ? [n] : t === "MultiPoint" || t === "LineString" ? n : t === "MultiLineString" || t === "Polygon" ? n.flat() : t === "MultiPolygon" ? n.flat(2) : t === "GeometryCollection" ? (e.geometries ?? []).flatMap(
|
|
1056
|
+
return t === "Point" ? [n] : t === "MultiPoint" || t === "LineString" ? n : t === "MultiLineString" || t === "Polygon" ? n.flat() : t === "MultiPolygon" ? n.flat(2) : t === "GeometryCollection" ? (e.geometries ?? []).flatMap(te) : [];
|
|
1049
1057
|
}
|
|
1050
|
-
const
|
|
1051
|
-
function
|
|
1052
|
-
const t =
|
|
1058
|
+
const G = 0.01;
|
|
1059
|
+
function Ct(e) {
|
|
1060
|
+
const t = te(e);
|
|
1053
1061
|
if (t.length === 0) return null;
|
|
1054
1062
|
let n = 1 / 0, r = 1 / 0, s = -1 / 0, i = -1 / 0;
|
|
1055
1063
|
for (const [l, o] of t)
|
|
1056
1064
|
l < n && (n = l), l > s && (s = l), o < r && (r = o), o > i && (i = o);
|
|
1057
|
-
return n === s && r === i && (n -=
|
|
1065
|
+
return n === s && r === i && (n -= G, r -= G, s += G, i += G), [n, r, s, i];
|
|
1058
1066
|
}
|
|
1059
1067
|
export {
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1068
|
+
ye as $,
|
|
1069
|
+
yt as A,
|
|
1070
|
+
mt as B,
|
|
1071
|
+
Te as C,
|
|
1072
|
+
it as D,
|
|
1073
|
+
Z as E,
|
|
1074
|
+
ht as F,
|
|
1075
|
+
bt as G,
|
|
1076
|
+
pt as H,
|
|
1077
|
+
ct as I,
|
|
1078
|
+
ft as J,
|
|
1079
|
+
Mt as K,
|
|
1080
|
+
St as L,
|
|
1081
|
+
wt as M,
|
|
1082
|
+
Pt as N,
|
|
1083
|
+
Ue as O,
|
|
1084
|
+
xe as P,
|
|
1085
|
+
De as Q,
|
|
1086
|
+
rt as R,
|
|
1079
1087
|
st as S,
|
|
1080
|
-
|
|
1081
|
-
|
|
1088
|
+
at as T,
|
|
1089
|
+
ot as U,
|
|
1082
1090
|
et as V,
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1091
|
+
nt as W,
|
|
1092
|
+
tt as X,
|
|
1093
|
+
lt as Y,
|
|
1094
|
+
Ie as Z,
|
|
1095
|
+
Je as _,
|
|
1096
|
+
ee as a,
|
|
1089
1097
|
$e as a0,
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1098
|
+
Pe as a1,
|
|
1099
|
+
we as a2,
|
|
1100
|
+
Se as a3,
|
|
1101
|
+
Me as a4,
|
|
1102
|
+
ve as a5,
|
|
1103
|
+
Re as a6,
|
|
1104
|
+
Ae as a7,
|
|
1105
|
+
ut as a8,
|
|
1106
|
+
gt as a9,
|
|
1107
|
+
D as aa,
|
|
1108
|
+
Ct as b,
|
|
1109
|
+
Ne as c,
|
|
1110
|
+
Ze as d,
|
|
1111
|
+
Y as e,
|
|
1103
1112
|
E as f,
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1113
|
+
Fe as g,
|
|
1114
|
+
Le as h,
|
|
1115
|
+
Ce as i,
|
|
1116
|
+
ze as j,
|
|
1117
|
+
Xe as k,
|
|
1118
|
+
We as l,
|
|
1119
|
+
Qe as m,
|
|
1120
|
+
L as n,
|
|
1121
|
+
ke as o,
|
|
1122
|
+
Ve as p,
|
|
1123
|
+
vt as q,
|
|
1124
|
+
$t as r,
|
|
1125
|
+
Ye as s,
|
|
1126
|
+
Ke as t,
|
|
1127
|
+
Ee as u,
|
|
1128
|
+
He as v,
|
|
1129
|
+
Be as w,
|
|
1130
|
+
je as x,
|
|
1131
|
+
H as y,
|
|
1132
|
+
dt as z
|
|
1124
1133
|
};
|