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