@kalisio/common-geospatial 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/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +617 -489
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -2
package/dist/index.mjs
CHANGED
|
@@ -1,154 +1,156 @@
|
|
|
1
|
-
import { assert as u, is as i, has as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
1
|
+
import { assert as u, is as i, has as w, conform as E, optional as p } from "@kalisio/common-core";
|
|
2
|
+
import { coordAll as R } from "@turf/meta";
|
|
3
|
+
import { convex as de } from "@turf/convex";
|
|
4
|
+
import { featureCollection as ve, feature as he } from "@turf/helpers";
|
|
5
|
+
import { Heap as pe } from "heap-js";
|
|
6
|
+
import Ee from "@turf/truncate";
|
|
7
|
+
import ye from "@turf/boolean-clockwise";
|
|
8
|
+
import Oe from "@turf/kinks";
|
|
7
9
|
const d = {
|
|
8
10
|
LATITUDE: "LAT",
|
|
9
11
|
LONGITUDE: "LON",
|
|
10
12
|
ALTITUDE: "ALT"
|
|
11
13
|
};
|
|
12
|
-
function
|
|
14
|
+
function Te(e) {
|
|
13
15
|
return u.that(e, i.string, "axis must be a string"), Object.values(d).includes(e);
|
|
14
16
|
}
|
|
15
|
-
function
|
|
17
|
+
function k(e) {
|
|
16
18
|
return u.that(e, i.string, "axis must be a string"), e === d.LATITUDE;
|
|
17
19
|
}
|
|
18
|
-
function
|
|
20
|
+
function ne(e) {
|
|
19
21
|
return u.that(e, i.string, "axis must be a string"), e === d.LONGITUDE;
|
|
20
22
|
}
|
|
21
|
-
function
|
|
23
|
+
function Ot(e) {
|
|
22
24
|
return u.that(e, i.string, "axis must be a string"), e === d.ALTITUDE;
|
|
23
25
|
}
|
|
24
|
-
const
|
|
25
|
-
DIRECTIONS:
|
|
26
|
-
},
|
|
27
|
-
DIRECTIONS:
|
|
28
|
-
},
|
|
26
|
+
const Ie = { NORTH: { label: "Nord", symbol: "N" }, SOUTH: { label: "Sud", symbol: "S" }, EAST: { label: "Est", symbol: "E" }, WEST: { label: "Ouest", symbol: "O" } }, Le = {
|
|
27
|
+
DIRECTIONS: Ie
|
|
28
|
+
}, Se = { NORTH: { label: "North", symbol: "N" }, SOUTH: { label: "South", symbol: "S" }, EAST: { label: "East", symbol: "E" }, WEST: { label: "West", symbol: "W" } }, be = {
|
|
29
|
+
DIRECTIONS: Se
|
|
30
|
+
}, De = {
|
|
29
31
|
DIRECTIONS: {
|
|
30
32
|
NORTH: { label: i.string, symbol: i.char },
|
|
31
33
|
SOUTH: { label: i.string, symbol: i.char },
|
|
32
34
|
EAST: { label: i.string, symbol: i.char },
|
|
33
35
|
WEST: { label: i.string, symbol: i.char }
|
|
34
36
|
}
|
|
35
|
-
},
|
|
36
|
-
en:
|
|
37
|
-
fr:
|
|
37
|
+
}, I = {
|
|
38
|
+
en: be,
|
|
39
|
+
fr: Le
|
|
38
40
|
};
|
|
39
|
-
let
|
|
40
|
-
const
|
|
41
|
-
function
|
|
42
|
-
return Object.keys(
|
|
41
|
+
let S = "en";
|
|
42
|
+
const z = "en";
|
|
43
|
+
function Tt() {
|
|
44
|
+
return Object.keys(I);
|
|
43
45
|
}
|
|
44
|
-
function
|
|
46
|
+
function It(e, t) {
|
|
45
47
|
u.all([
|
|
46
48
|
{ value: e, validator: i.string, message: "code must be a string" },
|
|
47
|
-
{ value: e, validator: (
|
|
49
|
+
{ value: e, validator: (n) => !w.key(I, n), message: "locale already registered" },
|
|
48
50
|
{ value: t, validator: i.plainObject, message: "content must be an object" },
|
|
49
|
-
{ value: t, validator: (
|
|
50
|
-
]),
|
|
51
|
+
{ value: t, validator: (n) => E.schema(n, De), message: "content does not conform to schema" }
|
|
52
|
+
]), I[e] = t;
|
|
51
53
|
}
|
|
52
|
-
function
|
|
54
|
+
function Lt(e) {
|
|
53
55
|
u.all([
|
|
54
56
|
{ value: e, validator: i.string, message: "code must be a string" },
|
|
55
|
-
{ value: e, validator: (t) =>
|
|
56
|
-
]),
|
|
57
|
+
{ value: e, validator: (t) => w.key(I, t), message: "code is unknown" }
|
|
58
|
+
]), S = e;
|
|
57
59
|
}
|
|
58
|
-
function
|
|
59
|
-
return
|
|
60
|
+
function Re() {
|
|
61
|
+
return S;
|
|
60
62
|
}
|
|
61
|
-
function
|
|
63
|
+
function B(e) {
|
|
62
64
|
return u.all([
|
|
63
65
|
{ value: e, validator: i.string, message: "code must be a string" },
|
|
64
|
-
{ value: e, validator: (t) =>
|
|
65
|
-
]),
|
|
66
|
+
{ value: e, validator: (t) => w.key(I, t), message: "code is unknown" }
|
|
67
|
+
]), I[e];
|
|
66
68
|
}
|
|
67
|
-
function
|
|
68
|
-
return
|
|
69
|
+
function re() {
|
|
70
|
+
return S === z ? [S] : [S, z];
|
|
69
71
|
}
|
|
70
|
-
function
|
|
72
|
+
function H(e) {
|
|
71
73
|
const t = /* @__PURE__ */ new Set();
|
|
72
|
-
for (const
|
|
73
|
-
const { DIRECTIONS:
|
|
74
|
-
for (const
|
|
74
|
+
for (const n of re()) {
|
|
75
|
+
const { DIRECTIONS: r } = B(n);
|
|
76
|
+
for (const a of e) t.add(r[a].symbol);
|
|
75
77
|
}
|
|
76
78
|
return [...t];
|
|
77
79
|
}
|
|
78
|
-
function
|
|
79
|
-
return
|
|
80
|
+
function Ae() {
|
|
81
|
+
return H(["NORTH", "SOUTH"]);
|
|
80
82
|
}
|
|
81
|
-
function
|
|
82
|
-
return
|
|
83
|
+
function Me() {
|
|
84
|
+
return H(["EAST", "WEST"]);
|
|
83
85
|
}
|
|
84
|
-
function
|
|
85
|
-
return
|
|
86
|
+
function j() {
|
|
87
|
+
return H(["NORTH", "SOUTH", "EAST", "WEST"]);
|
|
86
88
|
}
|
|
87
|
-
function
|
|
88
|
-
return
|
|
89
|
+
function b() {
|
|
90
|
+
return B(Re()).DIRECTIONS;
|
|
89
91
|
}
|
|
90
|
-
function
|
|
91
|
-
const
|
|
92
|
-
return
|
|
93
|
-
const { label:
|
|
94
|
-
return
|
|
92
|
+
function _(e, t) {
|
|
93
|
+
const n = t.toUpperCase();
|
|
94
|
+
return re().some((r) => {
|
|
95
|
+
const { label: a, symbol: s } = B(r).DIRECTIONS[e];
|
|
96
|
+
return n === a.toUpperCase() || n === s.toUpperCase();
|
|
95
97
|
});
|
|
96
98
|
}
|
|
97
|
-
function
|
|
98
|
-
const t =
|
|
99
|
-
return i.defined(e) ? (u.that(e,
|
|
99
|
+
function St(e = null) {
|
|
100
|
+
const t = b();
|
|
101
|
+
return i.defined(e) ? (u.that(e, Te, "axis must be a valid axis"), k(e) ? [t.SOUTH, t.NORTH] : ne(e) ? [t.EAST, t.WEST] : []) : [t.SOUTH, t.NORTH, t.EAST, t.WEST];
|
|
100
102
|
}
|
|
101
|
-
function
|
|
102
|
-
return
|
|
103
|
+
function bt() {
|
|
104
|
+
return b().NORTH;
|
|
103
105
|
}
|
|
104
|
-
function
|
|
105
|
-
return
|
|
106
|
+
function Dt() {
|
|
107
|
+
return b().SOUTH;
|
|
106
108
|
}
|
|
107
|
-
function
|
|
108
|
-
return
|
|
109
|
+
function Rt() {
|
|
110
|
+
return b().EAST;
|
|
109
111
|
}
|
|
110
|
-
function
|
|
111
|
-
return
|
|
112
|
+
function At() {
|
|
113
|
+
return b().WEST;
|
|
112
114
|
}
|
|
113
|
-
function
|
|
114
|
-
return u.that(e, i.string, "dir must be a string"),
|
|
115
|
+
function O(e) {
|
|
116
|
+
return u.that(e, i.string, "dir must be a string"), Ce(e) || ie(e) || V(e) || $(e);
|
|
115
117
|
}
|
|
116
|
-
function
|
|
117
|
-
return u.that(e, i.string, "dir must be a string"),
|
|
118
|
+
function Ce(e) {
|
|
119
|
+
return u.that(e, i.string, "dir must be a string"), _("NORTH", e);
|
|
118
120
|
}
|
|
119
|
-
function
|
|
120
|
-
return u.that(e, i.string, "dir must be a string"),
|
|
121
|
+
function ie(e) {
|
|
122
|
+
return u.that(e, i.string, "dir must be a string"), _("SOUTH", e);
|
|
121
123
|
}
|
|
122
|
-
function
|
|
123
|
-
return u.that(e, i.string, "dir must be a string"),
|
|
124
|
+
function V(e) {
|
|
125
|
+
return u.that(e, i.string, "dir must be a string"), _("EAST", e);
|
|
124
126
|
}
|
|
125
|
-
function
|
|
126
|
-
return u.that(e, i.string, "dir must be a string"),
|
|
127
|
+
function $(e) {
|
|
128
|
+
return u.that(e, i.string, "dir must be a string"), _("WEST", e);
|
|
127
129
|
}
|
|
128
|
-
function
|
|
129
|
-
return u.that(e,
|
|
130
|
+
function Ne(e) {
|
|
131
|
+
return u.that(e, O, "dir must be a direction"), $(e) || V(e) ? d.LONGITUDE : d.LATITUDE;
|
|
130
132
|
}
|
|
131
|
-
const
|
|
133
|
+
const we = {
|
|
132
134
|
degrees: i.number,
|
|
133
|
-
direction:
|
|
134
|
-
},
|
|
135
|
-
function
|
|
136
|
-
return new RegExp(`^(\\d{1,3}(?:\\.\\d+)?)°?([${
|
|
137
|
-
}
|
|
138
|
-
function
|
|
139
|
-
let t = null,
|
|
140
|
-
if (i.plainObject(e) &&
|
|
141
|
-
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees,
|
|
135
|
+
direction: p(O)
|
|
136
|
+
}, _e = /^(-?\d{1,3}(?:\.\d+)?)°?$/;
|
|
137
|
+
function $e() {
|
|
138
|
+
return new RegExp(`^(\\d{1,3}(?:\\.\\d+)?)°?([${j()}])$`, "i");
|
|
139
|
+
}
|
|
140
|
+
function D(e) {
|
|
141
|
+
let t = null, n = null;
|
|
142
|
+
if (i.plainObject(e) && E.schema(e, we))
|
|
143
|
+
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees, n = e.direction) : t = e.degrees;
|
|
142
144
|
else if (i.string(e)) {
|
|
143
|
-
const
|
|
144
|
-
|
|
145
|
+
const r = e.replace(/\s+/g, ""), a = r.match(_e) ?? r.match($e());
|
|
146
|
+
a && (t = parseFloat(a[1]), n = a[2] ?? null);
|
|
145
147
|
}
|
|
146
148
|
return {
|
|
147
149
|
get degrees() {
|
|
148
150
|
return t;
|
|
149
151
|
},
|
|
150
152
|
get direction() {
|
|
151
|
-
return
|
|
153
|
+
return n;
|
|
152
154
|
},
|
|
153
155
|
get format() {
|
|
154
156
|
return "DD";
|
|
@@ -156,261 +158,382 @@ function L(e) {
|
|
|
156
158
|
isValid() {
|
|
157
159
|
return i.number(t);
|
|
158
160
|
},
|
|
159
|
-
toString(
|
|
160
|
-
if (u.that(
|
|
161
|
-
let
|
|
162
|
-
return
|
|
161
|
+
toString(r) {
|
|
162
|
+
if (u.that(r, i.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
163
|
+
let a = `${t.toFixed(r)}°`;
|
|
164
|
+
return n && (a += ` ${n}`), a;
|
|
163
165
|
},
|
|
164
166
|
toDecimal() {
|
|
165
|
-
return this.isValid() ?
|
|
167
|
+
return this.isValid() ? D({ degrees: t, direction: n }) : null;
|
|
166
168
|
}
|
|
167
169
|
};
|
|
168
170
|
}
|
|
169
|
-
const
|
|
171
|
+
const Fe = {
|
|
170
172
|
degrees: i.integer,
|
|
171
173
|
minutes: (e) => i.inRangeExclusiveMax(e, 0, 60),
|
|
172
|
-
direction:
|
|
173
|
-
},
|
|
174
|
-
function
|
|
175
|
-
return new RegExp(`^(\\d{1,3})°(\\d{1,2}(?:\\.\\d+)?)'?([${
|
|
174
|
+
direction: p(O)
|
|
175
|
+
}, xe = /^(-?\d{1,3})°(\d{1,2}(?:\.\d+)?)'?$/;
|
|
176
|
+
function Ue() {
|
|
177
|
+
return new RegExp(`^(\\d{1,3})°(\\d{1,2}(?:\\.\\d+)?)'?([${j().join("")}])$`, "i");
|
|
176
178
|
}
|
|
177
|
-
function
|
|
178
|
-
let t = null,
|
|
179
|
-
if (i.plainObject(e) &&
|
|
180
|
-
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees,
|
|
179
|
+
function ae(e) {
|
|
180
|
+
let t = null, n = null, r = null;
|
|
181
|
+
if (i.plainObject(e) && E.schema(e, Fe))
|
|
182
|
+
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees, n = e.minutes, r = e.direction) : (t = e.degrees, n = e.minutes);
|
|
181
183
|
else if (i.string(e)) {
|
|
182
|
-
const
|
|
183
|
-
|
|
184
|
+
const a = e.replace(/\s+/g, ""), s = a.match(xe) ?? a.match(Ue());
|
|
185
|
+
s && (t = parseFloat(s[1]), n = parseFloat(s[2]), r = s[3] ?? null);
|
|
184
186
|
}
|
|
185
187
|
return {
|
|
186
188
|
get degrees() {
|
|
187
189
|
return t;
|
|
188
190
|
},
|
|
189
191
|
get minutes() {
|
|
190
|
-
return
|
|
192
|
+
return n;
|
|
191
193
|
},
|
|
192
194
|
get direction() {
|
|
193
|
-
return
|
|
195
|
+
return r;
|
|
194
196
|
},
|
|
195
197
|
get format() {
|
|
196
198
|
return "DDM";
|
|
197
199
|
},
|
|
198
200
|
isValid() {
|
|
199
|
-
return i.integer(t) && i.inRangeExclusiveMax(
|
|
201
|
+
return i.integer(t) && i.inRangeExclusiveMax(n, 0, 60);
|
|
200
202
|
},
|
|
201
|
-
toString(
|
|
202
|
-
if (u.that(
|
|
203
|
-
let
|
|
204
|
-
return
|
|
203
|
+
toString(a) {
|
|
204
|
+
if (u.that(a, i.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
205
|
+
let s = `${t}° ${n.toFixed(a)}'`;
|
|
206
|
+
return r && (s += ` ${r}`), s;
|
|
205
207
|
},
|
|
206
208
|
toDecimal() {
|
|
207
|
-
return this.isValid() ?
|
|
209
|
+
return this.isValid() ? D({ degrees: t + n / 60, direction: r }) : null;
|
|
208
210
|
}
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
|
-
const
|
|
213
|
+
const Ge = {
|
|
212
214
|
degrees: i.nonNegativeInteger,
|
|
213
215
|
minutes: (e) => i.inRangeExclusiveMax(e, 0, 60),
|
|
214
|
-
direction:
|
|
216
|
+
direction: O
|
|
215
217
|
};
|
|
216
|
-
function
|
|
217
|
-
return new RegExp(`^(\\d{2})(\\d{3})([${
|
|
218
|
+
function ke() {
|
|
219
|
+
return new RegExp(`^(\\d{2})(\\d{3})([${Ae().join("")}])$`, "i");
|
|
218
220
|
}
|
|
219
|
-
function
|
|
220
|
-
return new RegExp(`^(\\d{3})(\\d{3})([${
|
|
221
|
+
function Pe() {
|
|
222
|
+
return new RegExp(`^(\\d{3})(\\d{3})([${Me().join("")}])$`, "i");
|
|
221
223
|
}
|
|
222
|
-
function
|
|
223
|
-
let t = null,
|
|
224
|
-
if (i.plainObject(e) &&
|
|
225
|
-
t = e.degrees,
|
|
224
|
+
function se(e) {
|
|
225
|
+
let t = null, n = null, r = null;
|
|
226
|
+
if (i.plainObject(e) && E.schema(e, Ge))
|
|
227
|
+
t = e.degrees, n = e.minutes, r = e.direction;
|
|
226
228
|
else if (i.string(e)) {
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
+
const a = e.trim(), s = a.match(ke()) ?? a.match(Pe());
|
|
230
|
+
s && (t = parseFloat(s[1]), n = parseFloat(s[2]) / 10, r = s[3]);
|
|
229
231
|
}
|
|
230
232
|
return {
|
|
231
233
|
get degrees() {
|
|
232
234
|
return t;
|
|
233
235
|
},
|
|
234
236
|
get minutes() {
|
|
235
|
-
return
|
|
237
|
+
return n;
|
|
236
238
|
},
|
|
237
239
|
get direction() {
|
|
238
|
-
return
|
|
240
|
+
return r;
|
|
239
241
|
},
|
|
240
242
|
get format() {
|
|
241
243
|
return "DDM_AERO";
|
|
242
244
|
},
|
|
243
245
|
isValid() {
|
|
244
|
-
return i.nonNegativeInteger(t) && i.inRangeExclusiveMax(
|
|
246
|
+
return i.nonNegativeInteger(t) && i.inRangeExclusiveMax(n, 0, 60) && O(r);
|
|
245
247
|
},
|
|
246
248
|
toString() {
|
|
247
249
|
if (!this.isValid()) return "";
|
|
248
|
-
const
|
|
249
|
-
return `${
|
|
250
|
+
const a = V(r) || $(r), s = String(t).padStart(a ? 3 : 2, "0"), l = Math.floor(n * 10).toString().padStart(3, "0");
|
|
251
|
+
return `${s}${l}${r}`;
|
|
250
252
|
},
|
|
251
253
|
toDecimal() {
|
|
252
|
-
return this.isValid() ?
|
|
254
|
+
return this.isValid() ? D({ degrees: t + n / 60, direction: r }) : null;
|
|
253
255
|
}
|
|
254
256
|
};
|
|
255
257
|
}
|
|
256
|
-
const
|
|
258
|
+
const Be = {
|
|
257
259
|
degrees: i.integer,
|
|
258
260
|
minutes: (e) => i.integer(e) && i.inRange(e, 0, 59),
|
|
259
261
|
seconds: (e) => i.inRangeExclusiveMax(e, 0, 60),
|
|
260
|
-
direction:
|
|
261
|
-
},
|
|
262
|
-
function
|
|
263
|
-
return new RegExp(`^(\\d{1,3})°(\\d{1,2})'(\\d{1,2}(?:\\.\\d+)?)"?([${
|
|
264
|
-
}
|
|
265
|
-
function
|
|
266
|
-
let t = null,
|
|
267
|
-
if (i.plainObject(e) &&
|
|
268
|
-
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees,
|
|
262
|
+
direction: p(O)
|
|
263
|
+
}, He = /^(-?\d{1,3})°(\d{1,2})'(\d{1,2}(?:\.\d+)?)"?$/;
|
|
264
|
+
function je() {
|
|
265
|
+
return new RegExp(`^(\\d{1,3})°(\\d{1,2})'(\\d{1,2}(?:\\.\\d+)?)"?([${j().join("")}])$`, "i");
|
|
266
|
+
}
|
|
267
|
+
function oe(e) {
|
|
268
|
+
let t = null, n = null, r = null, a = null;
|
|
269
|
+
if (i.plainObject(e) && E.schema(e, Be))
|
|
270
|
+
i.defined(e.direction) ? e.degrees >= 0 && (t = e.degrees, n = e.minutes, r = e.seconds, a = e.direction) : (t = e.degrees, n = e.minutes, r = e.seconds);
|
|
269
271
|
else if (i.string(e)) {
|
|
270
|
-
const
|
|
271
|
-
l && (t = parseFloat(l[1]),
|
|
272
|
+
const s = e.replace(/\s+/g, ""), l = s.match(He) ?? s.match(je());
|
|
273
|
+
l && (t = parseFloat(l[1]), n = parseFloat(l[2]), r = parseFloat(l[3]), a = l[4] ?? null);
|
|
272
274
|
}
|
|
273
275
|
return {
|
|
274
276
|
get degrees() {
|
|
275
277
|
return t;
|
|
276
278
|
},
|
|
277
279
|
get minutes() {
|
|
278
|
-
return
|
|
280
|
+
return n;
|
|
279
281
|
},
|
|
280
282
|
get seconds() {
|
|
281
|
-
return
|
|
283
|
+
return r;
|
|
282
284
|
},
|
|
283
285
|
get direction() {
|
|
284
|
-
return
|
|
286
|
+
return a;
|
|
285
287
|
},
|
|
286
288
|
get format() {
|
|
287
289
|
return "DMS";
|
|
288
290
|
},
|
|
289
291
|
isValid() {
|
|
290
|
-
return i.integer(t) && i.integer(
|
|
292
|
+
return i.integer(t) && i.integer(n) && i.inRange(n, 0, 59) && i.inRangeExclusiveMax(r, 0, 60);
|
|
291
293
|
},
|
|
292
|
-
toString(
|
|
293
|
-
if (u.that(
|
|
294
|
-
let l = `${t}° ${
|
|
295
|
-
return
|
|
294
|
+
toString(s) {
|
|
295
|
+
if (u.that(s, i.positiveInteger, "decimalPlaces must be a positive integer"), !this.isValid()) return "";
|
|
296
|
+
let l = `${t}° ${n}' ${r.toFixed(s)}"`;
|
|
297
|
+
return a && (l += ` ${a}`), l;
|
|
296
298
|
},
|
|
297
299
|
toDecimal() {
|
|
298
|
-
return this.isValid() ?
|
|
300
|
+
return this.isValid() ? D({ degrees: t + n / 60 + r / 3600, direction: a }) : null;
|
|
299
301
|
}
|
|
300
302
|
};
|
|
301
303
|
}
|
|
302
|
-
function
|
|
303
|
-
const t = Math.floor(e.degrees),
|
|
304
|
-
return { degrees: t, minutes:
|
|
304
|
+
function q(e) {
|
|
305
|
+
const t = Math.floor(e.degrees), n = (e.degrees - t) * 60;
|
|
306
|
+
return { degrees: t, minutes: n, direction: e.direction };
|
|
305
307
|
}
|
|
306
|
-
function
|
|
307
|
-
const t = Math.floor(e.degrees),
|
|
308
|
-
return { degrees: t, minutes:
|
|
308
|
+
function Ve(e) {
|
|
309
|
+
const t = Math.floor(e.degrees), n = (e.degrees - t) * 60, r = Math.floor(n), a = (n - r) * 60;
|
|
310
|
+
return { degrees: t, minutes: r, seconds: a, direction: e.direction };
|
|
309
311
|
}
|
|
310
|
-
const
|
|
312
|
+
const Q = {
|
|
311
313
|
DD: (e) => (u.that(e, (t) => t.isValid(), "dd must be a valid coordinate"), e),
|
|
312
314
|
DDM: (e) => {
|
|
313
|
-
u.that(e, (
|
|
314
|
-
const { degrees: t, minutes:
|
|
315
|
-
return
|
|
315
|
+
u.that(e, (a) => a.isValid(), "dd must be a valid coordinate");
|
|
316
|
+
const { degrees: t, minutes: n, direction: r } = q(e);
|
|
317
|
+
return ae(r ? { degrees: t, minutes: n, direction: r } : { degrees: t, minutes: n });
|
|
316
318
|
},
|
|
317
319
|
DMS: (e) => {
|
|
318
|
-
u.that(e, (
|
|
319
|
-
const { degrees: t, minutes:
|
|
320
|
-
return
|
|
320
|
+
u.that(e, (s) => s.isValid(), "dd must be a valid coordinate");
|
|
321
|
+
const { degrees: t, minutes: n, seconds: r, direction: a } = Ve(e);
|
|
322
|
+
return oe(a ? { degrees: t, minutes: n, seconds: r, direction: a } : { degrees: t, minutes: n, seconds: r });
|
|
321
323
|
},
|
|
322
324
|
DDM_AERO: (e) => {
|
|
323
|
-
u.that(e, (
|
|
324
|
-
const { degrees: t, minutes:
|
|
325
|
-
return
|
|
325
|
+
u.that(e, (a) => a.isValid(), "dd must be a valid coordinate");
|
|
326
|
+
const { degrees: t, minutes: n, direction: r } = q(e);
|
|
327
|
+
return se({ degrees: t, minutes: n, direction: r });
|
|
326
328
|
}
|
|
327
|
-
},
|
|
329
|
+
}, P = {
|
|
328
330
|
DD: "DD",
|
|
329
331
|
DDM: "DDM",
|
|
330
332
|
DDM_AERO: "DDM_AERO",
|
|
331
333
|
DMS: "DMS"
|
|
332
|
-
},
|
|
333
|
-
DD:
|
|
334
|
-
DDM:
|
|
335
|
-
DDM_AERO:
|
|
336
|
-
DMS:
|
|
337
|
-
},
|
|
338
|
-
function
|
|
334
|
+
}, Ye = {
|
|
335
|
+
DD: D,
|
|
336
|
+
DDM: ae,
|
|
337
|
+
DDM_AERO: se,
|
|
338
|
+
DMS: oe
|
|
339
|
+
}, Y = Array.from({ length: 9 }, (e, t) => 10 ** t);
|
|
340
|
+
function Z(e, t) {
|
|
339
341
|
if (u.that(e, i.number, "coord must be a number"), i.defined(t))
|
|
340
|
-
return u.that(t,
|
|
342
|
+
return u.that(t, O, "dir must be a direction"), Ne(t);
|
|
341
343
|
if (Math.abs(e) > 90) return d.LONGITUDE;
|
|
342
344
|
}
|
|
343
|
-
function
|
|
345
|
+
function J(e) {
|
|
344
346
|
u.that(e, i.number, "coord must be a number");
|
|
345
|
-
const t = e.toExponential(), [
|
|
346
|
-
return Math.max(0,
|
|
347
|
+
const t = e.toExponential(), [n, r] = t.split("e").map(Number), a = (n.toString().split(".")[1] || "").length;
|
|
348
|
+
return Math.max(0, a - r);
|
|
347
349
|
}
|
|
348
|
-
function
|
|
350
|
+
function Mt(e, t = 7) {
|
|
349
351
|
u.all([
|
|
350
352
|
{ value: e, validator: i.number, message: "coord must be a number" },
|
|
351
|
-
{ value: t, validator: (
|
|
353
|
+
{ value: t, validator: (r) => i.inRange(r, 0, 8), message: "precision must be in range [0, 8]" }
|
|
352
354
|
]);
|
|
353
|
-
const
|
|
354
|
-
return Math.round(e *
|
|
355
|
+
const n = Y[t];
|
|
356
|
+
return Math.round(e * n) / n;
|
|
355
357
|
}
|
|
356
|
-
function
|
|
358
|
+
function Ct(e, t) {
|
|
357
359
|
if (u.all([
|
|
358
360
|
{ value: e, validator: i.number, message: "coord must be a number" },
|
|
359
|
-
{ value: t, validator: (
|
|
360
|
-
]),
|
|
361
|
+
{ value: t, validator: (r) => ne(r) || k(r), message: "axis must be either a longitude or latitude" }
|
|
362
|
+
]), k(t))
|
|
361
363
|
return Math.max(-90, Math.min(90, e));
|
|
362
|
-
let
|
|
363
|
-
return
|
|
364
|
+
let n = ((e + 180) % 360 + 360) % 360 - 180;
|
|
365
|
+
return n === -180 && (n = 180), Object.is(n, -0) && (n = 0), n;
|
|
364
366
|
}
|
|
365
|
-
function
|
|
367
|
+
function Nt(e, t) {
|
|
366
368
|
u.all([
|
|
367
|
-
{ value: e, validator: (
|
|
368
|
-
{ value: t, validator: (
|
|
369
|
+
{ value: e, validator: (r) => i.defined(r) && r.isValid(), message: "from must be a valid coordinate" },
|
|
370
|
+
{ value: t, validator: (r) => w.key(Q, r), message: `unknown format: ${t}` }
|
|
369
371
|
]);
|
|
370
|
-
const
|
|
371
|
-
return
|
|
372
|
+
const n = e.format === P.DD ? e : e.toDecimal();
|
|
373
|
+
return n.isValid() ? t === P.DD ? n : Q[t](n) : null;
|
|
372
374
|
}
|
|
373
|
-
function
|
|
375
|
+
function We(e) {
|
|
374
376
|
u.that(e, i.nonEmptyString, "pattern must be a non empty string");
|
|
375
|
-
for (const t of Object.keys(
|
|
376
|
-
const
|
|
377
|
-
if (
|
|
377
|
+
for (const t of Object.keys(P)) {
|
|
378
|
+
const n = Ye[t](e);
|
|
379
|
+
if (n.isValid()) return n;
|
|
378
380
|
}
|
|
379
381
|
return null;
|
|
380
382
|
}
|
|
381
|
-
function
|
|
382
|
-
u.that(e, (
|
|
383
|
+
function wt(e) {
|
|
384
|
+
u.that(e, (o) => i.nonEmptyString(o), "pattern must be a non-empty string");
|
|
383
385
|
const t = e.split(/[,;|]/);
|
|
384
386
|
if (t.length !== 2) return null;
|
|
385
|
-
const [
|
|
386
|
-
if (!
|
|
387
|
-
const
|
|
388
|
-
const { degrees:
|
|
389
|
-
return f && (
|
|
387
|
+
const [n, r] = t.map(We);
|
|
388
|
+
if (!n || !r) return null;
|
|
389
|
+
const a = n.toDecimal(), s = r.toDecimal(), l = Z(a.degrees, a.direction), m = Z(s.degrees, s.direction), c = (o) => {
|
|
390
|
+
const { degrees: v, direction: f } = o;
|
|
391
|
+
return f && ($(f) || ie(f)) ? -v : v;
|
|
390
392
|
};
|
|
391
|
-
if (l === d.LONGITUDE &&
|
|
392
|
-
if (
|
|
393
|
-
if (l === d.LONGITUDE && !
|
|
394
|
-
if (l === d.LATITUDE && !
|
|
395
|
-
if (
|
|
396
|
-
if (
|
|
397
|
-
if (!l && !
|
|
393
|
+
if (l === d.LONGITUDE && m === d.LATITUDE) return [c(a), c(s)];
|
|
394
|
+
if (m === d.LONGITUDE && l === d.LATITUDE) return [c(s), c(a)];
|
|
395
|
+
if (l === d.LONGITUDE && !m) return [c(a), s];
|
|
396
|
+
if (l === d.LATITUDE && !m) return [c(s), c(a)];
|
|
397
|
+
if (m === d.LONGITUDE && !l) return [c(s), c(a)];
|
|
398
|
+
if (m === d.LATITUDE && !l) return [c(a), c(s)];
|
|
399
|
+
if (!l && !m)
|
|
398
400
|
return [
|
|
399
|
-
[c(
|
|
400
|
-
[c(
|
|
401
|
+
[c(a), c(s)],
|
|
402
|
+
[c(s), c(a)]
|
|
401
403
|
];
|
|
402
404
|
}
|
|
403
|
-
function
|
|
404
|
-
return !i.
|
|
405
|
+
function y(e) {
|
|
406
|
+
return !(!i.arrayOfLengthBetween(e, 2, 3) || !i.number(e[0]) || !i.number(e[1]) || !i.inRange(e[0], -180, 180) || !i.inRange(e[1], -90, 90) || e.length === 3 && !i.number(e[2]));
|
|
407
|
+
}
|
|
408
|
+
function Xe(e) {
|
|
409
|
+
return u.that(e, y, "position must be a valid position"), i.arrayOfLength(e, 3);
|
|
410
|
+
}
|
|
411
|
+
const Ke = {
|
|
412
|
+
precision: p(i.number),
|
|
413
|
+
consider3D: p(i.boolean)
|
|
414
|
+
};
|
|
415
|
+
function _t(e, t, n = {}) {
|
|
416
|
+
u.all([
|
|
417
|
+
{
|
|
418
|
+
value: e,
|
|
419
|
+
validator: y,
|
|
420
|
+
message: "position1 must be a valid position"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
value: t,
|
|
424
|
+
validator: y,
|
|
425
|
+
message: "position2 must be a valid position"
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
value: n,
|
|
429
|
+
validator: (l) => E.schema(l, Ke),
|
|
430
|
+
message: "options must be a valid options object"
|
|
431
|
+
}
|
|
432
|
+
]);
|
|
433
|
+
const { precision: r = 10, consider3D: a = !1 } = n, s = a ? Math.max(e.length, t.length) : 2;
|
|
434
|
+
return Array.from(
|
|
435
|
+
{ length: s },
|
|
436
|
+
(l, m) => (e[m] ?? 0).toFixed(r) === (t[m] ?? 0).toFixed(r)
|
|
437
|
+
).every(Boolean);
|
|
438
|
+
}
|
|
439
|
+
function $t(e, t = 7) {
|
|
440
|
+
u.all([
|
|
441
|
+
{ value: e, validator: y, message: "position must be a position" },
|
|
442
|
+
{ value: t, validator: (r) => i.inRange(r, 0, 8), message: "precision must be in range [0, 8]" }
|
|
443
|
+
]);
|
|
444
|
+
const n = Y[t];
|
|
445
|
+
for (let r = 0; r < e.length; r++)
|
|
446
|
+
e[r] = Math.round(e[r] * n) / n;
|
|
447
|
+
return e;
|
|
448
|
+
}
|
|
449
|
+
function A(e) {
|
|
450
|
+
if (!i.arrayOfLength(e, 4) && !i.arrayOfLength(e, 6)) return !1;
|
|
451
|
+
const t = e.length === 4, n = t ? [e[0], e[1]] : [e[0], e[1], e[2]], r = t ? [e[2], e[3]] : [e[3], e[4], e[5]];
|
|
452
|
+
if (!y(n) || !y(r)) return !1;
|
|
453
|
+
const [, a] = n, [, s] = r;
|
|
454
|
+
return !(a > s || !t && e[2] > e[5]);
|
|
405
455
|
}
|
|
406
|
-
|
|
456
|
+
function ee(e) {
|
|
457
|
+
return u.that(e, A, "bbox must be a valid bounding-box"), i.arrayOfLength(e, 6);
|
|
458
|
+
}
|
|
459
|
+
function Ft(e, t) {
|
|
460
|
+
return u.all([
|
|
461
|
+
{ value: e, validator: A, message: "bbox1 must be a valid bounding-box" },
|
|
462
|
+
{ value: t, validator: A, message: "bbox2 must be a valid bounding-box" }
|
|
463
|
+
]), ee(e) && ee(t) ? [
|
|
464
|
+
Math.min(e[0], t[0]),
|
|
465
|
+
Math.min(e[1], t[1]),
|
|
466
|
+
Math.min(e[2], t[2]),
|
|
467
|
+
Math.max(e[3], t[3]),
|
|
468
|
+
Math.max(e[4], t[4]),
|
|
469
|
+
Math.max(e[5], t[5])
|
|
470
|
+
] : [
|
|
471
|
+
Math.min(e[0], t[0]),
|
|
472
|
+
Math.min(e[1], t[1]),
|
|
473
|
+
Math.max(e[2], t[2]),
|
|
474
|
+
Math.max(e[3], t[3])
|
|
475
|
+
];
|
|
476
|
+
}
|
|
477
|
+
const ze = {
|
|
478
|
+
ignore3D: p(i.boolean)
|
|
479
|
+
};
|
|
480
|
+
function x(e, t = {}) {
|
|
481
|
+
u.all([
|
|
482
|
+
{
|
|
483
|
+
value: e,
|
|
484
|
+
validator: i.nonEmptyArray,
|
|
485
|
+
message: "positions must be a non-empty array"
|
|
486
|
+
},
|
|
487
|
+
{
|
|
488
|
+
value: e,
|
|
489
|
+
validator: (a) => a.every(y),
|
|
490
|
+
message: "positions must be an array of valid positions"
|
|
491
|
+
},
|
|
492
|
+
{
|
|
493
|
+
value: t,
|
|
494
|
+
validator: (a) => E.schema(a, ze),
|
|
495
|
+
message: "options must be a valid options object"
|
|
496
|
+
}
|
|
497
|
+
]);
|
|
498
|
+
const { ignore3D: n = !1 } = t;
|
|
499
|
+
return !n && e.some(Xe) ? e.reduce((a, s) => [
|
|
500
|
+
Math.min(a[0], s[0]),
|
|
501
|
+
Math.min(a[1], s[1]),
|
|
502
|
+
Math.min(a[2], s[2] ?? 0),
|
|
503
|
+
Math.max(a[3], s[0]),
|
|
504
|
+
Math.max(a[4], s[1]),
|
|
505
|
+
Math.max(a[5], s[2] ?? 0)
|
|
506
|
+
], [1 / 0, 1 / 0, 1 / 0, -1 / 0, -1 / 0, -1 / 0]) : e.reduce((a, s) => [
|
|
507
|
+
Math.min(a[0], s[0]),
|
|
508
|
+
Math.min(a[1], s[1]),
|
|
509
|
+
Math.max(a[2], s[0]),
|
|
510
|
+
Math.max(a[3], s[1])
|
|
511
|
+
], [1 / 0, 1 / 0, -1 / 0, -1 / 0]);
|
|
512
|
+
}
|
|
513
|
+
function ue(e, t = 7) {
|
|
514
|
+
u.all([
|
|
515
|
+
{ value: e, validator: A, message: "bbox must be a valid bounding box" },
|
|
516
|
+
{ value: t, validator: (r) => i.inRange(r, 0, 8), message: "precision must be in range [0, 8]" }
|
|
517
|
+
]);
|
|
518
|
+
const n = Y[t];
|
|
519
|
+
for (let r = 0; r < e.length; r++)
|
|
520
|
+
e[r] = Math.round(e[r] * n) / n;
|
|
521
|
+
return e;
|
|
522
|
+
}
|
|
523
|
+
const M = {
|
|
407
524
|
NAME: "name",
|
|
408
525
|
LINK: "link"
|
|
409
526
|
};
|
|
410
|
-
function
|
|
411
|
-
return i.plainObject(e) ? e.type ===
|
|
527
|
+
function xt(e) {
|
|
528
|
+
return i.plainObject(e) ? e.type === M.NAME ? i.nonEmptyString(e.properties?.name) : e.type === M.LINK ? i.nonEmptyString(e.properties?.href) : !1 : !1;
|
|
412
529
|
}
|
|
413
|
-
|
|
530
|
+
function Ut(e) {
|
|
531
|
+
return i.arrayOfLengthBetween(e, 2, 3) ? e.every(i.number) : !1;
|
|
532
|
+
}
|
|
533
|
+
function Gt(e) {
|
|
534
|
+
return !i.arrayOfLength(e, 4) && !i.arrayOfLength(e, 6) ? !1 : e.every(i.number);
|
|
535
|
+
}
|
|
536
|
+
const g = {
|
|
414
537
|
POINT: "Point",
|
|
415
538
|
MULTI_POINT: "MultiPoint",
|
|
416
539
|
LINESTRING: "LineString",
|
|
@@ -419,132 +542,129 @@ const m = {
|
|
|
419
542
|
MULTI_POLYGON: "MultiPolygon",
|
|
420
543
|
GEOMETRY_COLLECTION: "GeometryCollection"
|
|
421
544
|
};
|
|
422
|
-
function
|
|
423
|
-
return !i.plainObject(e) || !i.oneOf(e.type, Object.values(
|
|
545
|
+
function qe(e) {
|
|
546
|
+
return !i.plainObject(e) || !i.oneOf(e.type, Object.values(g)) ? !1 : e.type === g.GEOMETRY_COLLECTION ? i.array(e.geometries) : i.array(e.coordinates);
|
|
424
547
|
}
|
|
425
|
-
const
|
|
548
|
+
const h = {
|
|
426
549
|
FEATURE: "Feature",
|
|
427
550
|
FEATURE_COLLECTION: "FeatureCollection"
|
|
428
551
|
};
|
|
429
|
-
function
|
|
430
|
-
return i.plainObject(e)
|
|
552
|
+
function Qe(e) {
|
|
553
|
+
return i.plainObject(e) && e.type === h.FEATURE;
|
|
431
554
|
}
|
|
432
|
-
function
|
|
433
|
-
return
|
|
555
|
+
function Ze(e) {
|
|
556
|
+
return i.plainObject(e) && e.type === h.FEATURE_COLLECTION && i.array(e.features);
|
|
434
557
|
}
|
|
435
|
-
function
|
|
436
|
-
return
|
|
558
|
+
function Je(e) {
|
|
559
|
+
return Qe(e) || Ze(e);
|
|
437
560
|
}
|
|
438
|
-
function
|
|
439
|
-
return
|
|
561
|
+
function F(e) {
|
|
562
|
+
return Je(e) || qe(e);
|
|
440
563
|
}
|
|
441
|
-
|
|
564
|
+
const et = {
|
|
565
|
+
ignore3D: p(i.boolean)
|
|
566
|
+
};
|
|
567
|
+
function kt(e, t = {}) {
|
|
568
|
+
if (u.all([
|
|
569
|
+
{ value: e, validator: F, message: "geoJson must be a GeoJson object" },
|
|
570
|
+
{ value: t, validator: (n) => E.schema(n, et), message: "options must be a valid options object" }
|
|
571
|
+
]), e.type === h.FEATURE)
|
|
572
|
+
return e.geometry ? x(R(e.geometry), t) : null;
|
|
573
|
+
if (e.type === h.FEATURE_COLLECTION) {
|
|
574
|
+
const n = R(e);
|
|
575
|
+
return n.length ? x(n, t) : null;
|
|
576
|
+
}
|
|
577
|
+
return x(R(e), t);
|
|
578
|
+
}
|
|
579
|
+
function tt(e) {
|
|
580
|
+
if (e.length === 0) return null;
|
|
581
|
+
if (e.length === 1) return { type: "Point", coordinates: e[0] };
|
|
582
|
+
if (e.length === 2) return { type: "LineString", coordinates: [e[0], e[1]] };
|
|
583
|
+
const t = de(ve(e.map((n) => he({ type: "Point", coordinates: n }))));
|
|
584
|
+
return t ? t.geometry : { type: "LineString", coordinates: [e[0], e[e.length - 1]] };
|
|
585
|
+
}
|
|
586
|
+
function nt(e) {
|
|
587
|
+
if (u.that(e, F, "geoJson must be a GeoJson object"), e.type === h.FEATURE)
|
|
588
|
+
return e.geometry ? nt(e.geometry) : null;
|
|
589
|
+
const t = R(e).map((n) => [n[0], n[1]]);
|
|
590
|
+
return tt(t);
|
|
591
|
+
}
|
|
592
|
+
function rt(e, t, n) {
|
|
442
593
|
return Math.abs(
|
|
443
|
-
(e[0] * (t[1] -
|
|
594
|
+
(e[0] * (t[1] - n[1]) + t[0] * (n[1] - e[1]) + n[0] * (e[1] - t[1])) / 2
|
|
444
595
|
);
|
|
445
596
|
}
|
|
446
|
-
function
|
|
597
|
+
function U(e, { tolerance: t = 0, getWeight: n = () => 1 } = {}) {
|
|
447
598
|
if (e.length <= 2) return e;
|
|
448
|
-
const
|
|
449
|
-
for (let
|
|
450
|
-
|
|
451
|
-
const
|
|
452
|
-
for (let
|
|
453
|
-
|
|
599
|
+
const r = e.map((o, v) => ({ coord: o, i: v, area: 1 / 0, removed: !1, prev: null, next: null }));
|
|
600
|
+
for (let o = 0; o < r.length; o++)
|
|
601
|
+
o > 0 && (r[o].prev = r[o - 1]), o < r.length - 1 && (r[o].next = r[o + 1]);
|
|
602
|
+
const a = (o) => !o.prev || !o.next ? 1 / 0 : rt(o.prev.coord, o.coord, o.next.coord) * n(o.coord, o.i), s = new pe((o, v) => o.area - v.area);
|
|
603
|
+
for (let o = 1; o < r.length - 1; o++)
|
|
604
|
+
r[o].area = a(r[o]), r[o]._currentArea = r[o].area, s.push(r[o]);
|
|
454
605
|
let l = 0;
|
|
455
|
-
for (;
|
|
456
|
-
const
|
|
457
|
-
if (!
|
|
458
|
-
if (
|
|
459
|
-
|
|
606
|
+
for (; s.size() > 0; ) {
|
|
607
|
+
const o = s.pop();
|
|
608
|
+
if (!o.removed && o.area === o._currentArea) {
|
|
609
|
+
if (o.area < l ? o.area = l : l = o.area, o.area >= t) break;
|
|
610
|
+
o.removed = !0, o.prev && (o.prev.next = o.next), o.next && (o.next.prev = o.prev), o.prev?.prev && (o.prev.area = a(o.prev), o.prev._currentArea = o.prev.area, s.push(o.prev)), o.next?.next && (o.next.area = a(o.next), o.next._currentArea = o.next.area, s.push(o.next));
|
|
460
611
|
}
|
|
461
612
|
}
|
|
462
|
-
const
|
|
463
|
-
let c =
|
|
613
|
+
const m = [];
|
|
614
|
+
let c = r[0];
|
|
464
615
|
for (; c; )
|
|
465
|
-
c.removed ||
|
|
466
|
-
return
|
|
467
|
-
}
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
616
|
+
c.removed || m.push(c.coord), c = c.next;
|
|
617
|
+
return m;
|
|
618
|
+
}
|
|
619
|
+
const it = {
|
|
620
|
+
tolerance: p(i.number),
|
|
621
|
+
getWeight: p(i.function)
|
|
622
|
+
};
|
|
623
|
+
function G(e, t = {}) {
|
|
624
|
+
if (u.all([
|
|
625
|
+
{ value: e, validator: F, message: "geoJson must be a GeoJson object" },
|
|
626
|
+
{ value: t, validator: (n) => E.schema(n, it), message: "options must be a valid options object" }
|
|
627
|
+
]), e.type === h.FEATURE)
|
|
628
|
+
return e.geometry && G(e.geometry, t), e;
|
|
629
|
+
if (e.type === h.FEATURE_COLLECTION) {
|
|
630
|
+
for (const n of e.features) G(n, t);
|
|
631
|
+
return e;
|
|
632
|
+
}
|
|
633
|
+
switch (e.type) {
|
|
634
|
+
case g.LINESTRING:
|
|
635
|
+
e.coordinates = U(e.coordinates, t);
|
|
474
636
|
break;
|
|
475
|
-
case
|
|
476
|
-
case
|
|
477
|
-
e.coordinates = e.coordinates.map((
|
|
637
|
+
case g.POLYGON:
|
|
638
|
+
case g.MULTI_LINESTRING:
|
|
639
|
+
e.coordinates = e.coordinates.map((n) => U(n, t));
|
|
478
640
|
break;
|
|
479
|
-
case
|
|
480
|
-
e.coordinates = e.coordinates.map((
|
|
641
|
+
case g.MULTI_POLYGON:
|
|
642
|
+
e.coordinates = e.coordinates.map((n) => n.map((r) => U(r, t)));
|
|
481
643
|
break;
|
|
482
|
-
case
|
|
483
|
-
e.geometries.forEach((
|
|
644
|
+
case g.GEOMETRY_COLLECTION:
|
|
645
|
+
e.geometries.forEach((n) => G(n, t));
|
|
484
646
|
break;
|
|
485
647
|
}
|
|
486
648
|
return e;
|
|
487
649
|
}
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
e.geometry && H(e.geometry, t);
|
|
492
|
-
else if (e.type === v.FEATURE_COLLECTION)
|
|
493
|
-
for (const r of e.features) se(r, t);
|
|
494
|
-
else
|
|
495
|
-
Ke.warn('Unknown feature type "{type}", skipping.', { type: e.type });
|
|
496
|
-
return e;
|
|
497
|
-
}
|
|
498
|
-
function Tt(e, t) {
|
|
499
|
-
return u.all([
|
|
500
|
-
{ value: e, validator: ie, message: "geoJson must be a GeoJson object" }
|
|
501
|
-
]), i.oneOf(e.type, Object.values(m)) ? H(e, t) : se(e, t);
|
|
502
|
-
}
|
|
503
|
-
function ae(e, t = 7) {
|
|
504
|
-
u.all([
|
|
505
|
-
{ value: e, validator: Ve, message: "bbox must be bounding box" },
|
|
506
|
-
{ value: t, validator: (n) => i.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
507
|
-
]);
|
|
508
|
-
const r = G[t];
|
|
509
|
-
for (let n = 0; n < e.length; n++)
|
|
510
|
-
e[n] = Math.round(e[n] * r) / r;
|
|
511
|
-
return e;
|
|
650
|
+
function le(e, t = 7) {
|
|
651
|
+
const n = Ee(e, { precision: t, mutate: !0 });
|
|
652
|
+
return n.bbox && ue(n.bbox, t), n;
|
|
512
653
|
}
|
|
513
|
-
function
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
{ value: t, validator: (n) => i.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
517
|
-
]);
|
|
518
|
-
const r = me(e, { precision: t, mutate: !0 });
|
|
519
|
-
return r.bbox && ae(r.bbox, t), r;
|
|
520
|
-
}
|
|
521
|
-
const Xe = Q(["common-ekosystem", "truncate", "geojson"]);
|
|
522
|
-
function ue(e, t) {
|
|
523
|
-
if (e.type === v.FEATURE)
|
|
524
|
-
e.geometry && oe(e.geometry, t);
|
|
525
|
-
else if (e.type === v.FEATURE_COLLECTION)
|
|
526
|
-
for (const r of e.features) ue(r, t);
|
|
654
|
+
function ce(e, t) {
|
|
655
|
+
if (e.type === h.FEATURE)
|
|
656
|
+
e.geometry && le(e.geometry, t);
|
|
527
657
|
else
|
|
528
|
-
|
|
529
|
-
return e.bbox &&
|
|
658
|
+
for (const n of e.features) ce(n, t);
|
|
659
|
+
return e.bbox && ue(e.bbox, t), e;
|
|
530
660
|
}
|
|
531
|
-
function
|
|
661
|
+
function Pt(e, t = 7) {
|
|
532
662
|
return u.all([
|
|
533
|
-
{ value: e, validator:
|
|
534
|
-
{ value: t, validator: (r) => i.inRange(r, 0, 8), message: "precision must be in range [0, 8]" }
|
|
535
|
-
]), i.oneOf(e.type, Object.values(m)) ? oe(e, t) : ue(e, t);
|
|
536
|
-
}
|
|
537
|
-
function Lt(e, t = 7) {
|
|
538
|
-
u.all([
|
|
539
|
-
{ value: e, validator: Ye, message: "position must be a position" },
|
|
663
|
+
{ value: e, validator: F, message: "geoJson must be a valid GeoJson" },
|
|
540
664
|
{ value: t, validator: (n) => i.inRange(n, 0, 8), message: "precision must be in range [0, 8]" }
|
|
541
|
-
]);
|
|
542
|
-
const r = G[t];
|
|
543
|
-
for (let n = 0; n < e.length; n++)
|
|
544
|
-
e[n] = Math.round(e[n] * r) / r;
|
|
545
|
-
return e;
|
|
665
|
+
]), i.oneOf(e.type, Object.values(g)) ? le(e, t) : ce(e, t);
|
|
546
666
|
}
|
|
547
|
-
function
|
|
667
|
+
function C(e) {
|
|
548
668
|
if (!i.arrayOfLengthBetween(e, 2, 3))
|
|
549
669
|
return {
|
|
550
670
|
valid: !1,
|
|
@@ -575,52 +695,52 @@ function R(e) {
|
|
|
575
695
|
errors: [{ message: "Invalid coordinates: altitude must be a number" }],
|
|
576
696
|
warnings: []
|
|
577
697
|
};
|
|
578
|
-
const t = { valid: !0, errors: [], warnings: [] },
|
|
579
|
-
|
|
580
|
-
const
|
|
581
|
-
return
|
|
698
|
+
const t = { valid: !0, errors: [], warnings: [] }, n = J(e[0]);
|
|
699
|
+
n > 6 && t.warnings.push({ message: `longitude precision is high (${n} decimals, max recommended: 6)` });
|
|
700
|
+
const r = J(e[1]);
|
|
701
|
+
return r > 6 && t.warnings.push({ message: `latitude precision is high (${r} decimals, max recommended: 6)` }), t;
|
|
582
702
|
}
|
|
583
|
-
function
|
|
703
|
+
function at(e) {
|
|
584
704
|
if (!i.arrayOfLength(e, 4) && !i.arrayOfLength(e, 6))
|
|
585
705
|
return {
|
|
586
706
|
valid: !1,
|
|
587
707
|
errors: [{ message: "Invalid bbox: must be an array of 4 (2D) or 6 (3D) numbers" }],
|
|
588
708
|
warnings: []
|
|
589
709
|
};
|
|
590
|
-
const t = e.length === 4,
|
|
591
|
-
if (!
|
|
710
|
+
const t = e.length === 4, n = t ? [e[0], e[1]] : [e[0], e[1], e[2]], r = t ? [e[2], e[3]] : [e[3], e[4], e[5]], a = C(n);
|
|
711
|
+
if (!a.valid)
|
|
592
712
|
return {
|
|
593
713
|
valid: !1,
|
|
594
|
-
errors:
|
|
714
|
+
errors: a.errors.map((f) => ({ ...f, message: `Invalid bbox south-west: ${f.message}` })),
|
|
595
715
|
warnings: []
|
|
596
716
|
};
|
|
597
|
-
const
|
|
598
|
-
if (!
|
|
717
|
+
const s = C(r);
|
|
718
|
+
if (!s.valid)
|
|
599
719
|
return {
|
|
600
720
|
valid: !1,
|
|
601
|
-
errors:
|
|
721
|
+
errors: s.errors.map((f) => ({ ...f, message: `Invalid bbox north-east: ${f.message}` })),
|
|
602
722
|
warnings: []
|
|
603
723
|
};
|
|
604
|
-
const [l,
|
|
605
|
-
if (
|
|
724
|
+
const [l, m] = n, [c, o] = r;
|
|
725
|
+
if (m > o)
|
|
606
726
|
return {
|
|
607
727
|
valid: !1,
|
|
608
|
-
errors: [{ message: `Invalid bbox: south (${
|
|
728
|
+
errors: [{ message: `Invalid bbox: south (${m}) must be <= north (${o})` }],
|
|
609
729
|
warnings: []
|
|
610
730
|
};
|
|
611
731
|
if (!t) {
|
|
612
|
-
const f = e[2],
|
|
613
|
-
if (f >
|
|
732
|
+
const f = e[2], K = e[5];
|
|
733
|
+
if (f > K)
|
|
614
734
|
return {
|
|
615
735
|
valid: !1,
|
|
616
|
-
errors: [{ message: `Invalid bbox: min altitude (${f}) must be <= max altitude (${
|
|
736
|
+
errors: [{ message: `Invalid bbox: min altitude (${f}) must be <= max altitude (${K})` }],
|
|
617
737
|
warnings: []
|
|
618
738
|
};
|
|
619
739
|
}
|
|
620
|
-
const
|
|
621
|
-
return l > c &&
|
|
740
|
+
const v = { valid: !0, errors: [], warnings: [] };
|
|
741
|
+
return l > c && v.warnings.push({ message: `bbox crosses the antimeridian (west: ${l} > east: ${c})` }), v.warnings.push(...a.warnings.map((f) => ({ ...f, message: `south-west: ${f.message}` }))), v.warnings.push(...s.warnings.map((f) => ({ ...f, message: `north-east: ${f.message}` }))), v;
|
|
622
742
|
}
|
|
623
|
-
function
|
|
743
|
+
function st(e) {
|
|
624
744
|
if (!i.plainObject(e))
|
|
625
745
|
return {
|
|
626
746
|
valid: !1,
|
|
@@ -628,13 +748,13 @@ function qe(e) {
|
|
|
628
748
|
warnings: []
|
|
629
749
|
};
|
|
630
750
|
switch (e.type) {
|
|
631
|
-
case
|
|
751
|
+
case M.NAME:
|
|
632
752
|
return i.nonEmptyString(e.properties?.name) ? { valid: !0, errors: [], warnings: [] } : {
|
|
633
753
|
valid: !1,
|
|
634
754
|
errors: [{ message: "Invalid crs: linked crs must have a non-empty properties.name string" }],
|
|
635
755
|
warnings: []
|
|
636
756
|
};
|
|
637
|
-
case
|
|
757
|
+
case M.LINK:
|
|
638
758
|
return i.nonEmptyString(e.properties?.href) ? { valid: !0, errors: [], warnings: [] } : {
|
|
639
759
|
valid: !1,
|
|
640
760
|
errors: [{ message: "Invalid crs: linked crs must have a non-empty properties.href string" }],
|
|
@@ -648,147 +768,147 @@ function qe(e) {
|
|
|
648
768
|
};
|
|
649
769
|
}
|
|
650
770
|
}
|
|
651
|
-
function
|
|
771
|
+
function T() {
|
|
652
772
|
return { Feature: 0, FeatureCollection: 0, geometries: {} };
|
|
653
773
|
}
|
|
654
|
-
function
|
|
655
|
-
const t =
|
|
656
|
-
for (const
|
|
657
|
-
const
|
|
658
|
-
if (
|
|
659
|
-
t.Feature +=
|
|
660
|
-
for (const [
|
|
661
|
-
t.geometries[
|
|
774
|
+
function ot(...e) {
|
|
775
|
+
const t = T();
|
|
776
|
+
for (const n of e) {
|
|
777
|
+
const r = n.statistics;
|
|
778
|
+
if (r) {
|
|
779
|
+
t.Feature += r.Feature ?? 0, t.FeatureCollection += r.FeatureCollection ?? 0;
|
|
780
|
+
for (const [a, s] of Object.entries(r.geometries ?? {}))
|
|
781
|
+
t.geometries[a] = (t.geometries[a] ?? 0) + s;
|
|
662
782
|
}
|
|
663
783
|
}
|
|
664
784
|
return t;
|
|
665
785
|
}
|
|
666
|
-
function
|
|
667
|
-
const
|
|
786
|
+
function L(e, t, n = "") {
|
|
787
|
+
const r = {
|
|
668
788
|
valid: !0,
|
|
669
789
|
errors: [],
|
|
670
790
|
warnings: [],
|
|
671
|
-
statistics:
|
|
791
|
+
statistics: T()
|
|
672
792
|
};
|
|
673
|
-
for (let
|
|
674
|
-
const
|
|
675
|
-
if (l.statistics && (
|
|
676
|
-
|
|
793
|
+
for (let a = 0; a < e.length; a++) {
|
|
794
|
+
const s = `${n}/${a}`, l = t(e[a], s, a);
|
|
795
|
+
if (l.statistics && (r.statistics = ot(r, l)), !l.valid) {
|
|
796
|
+
r.valid = !1, r.errors = r.errors.concat(l.errors.map((m) => ({ ...m, path: m.path || s, index: a })));
|
|
677
797
|
continue;
|
|
678
798
|
}
|
|
679
|
-
i.empty(l.warnings) || (
|
|
799
|
+
i.empty(l.warnings) || (r.warnings = r.warnings.concat(l.warnings.map((m) => ({ ...m, path: m.path || s, index: a }))));
|
|
680
800
|
}
|
|
681
|
-
return
|
|
801
|
+
return r;
|
|
682
802
|
}
|
|
683
|
-
function
|
|
803
|
+
function te(e, t) {
|
|
684
804
|
if (!i.defined(e.crs)) return t;
|
|
685
|
-
const
|
|
686
|
-
return
|
|
805
|
+
const n = st(e.crs);
|
|
806
|
+
return n.valid || (t.valid = !1, t.errors.push(...n.errors.map((r) => ({ ...r, path: "/crs" })))), t.warnings.push(...n.warnings.map((r) => ({ ...r, path: "/crs" }))), t;
|
|
687
807
|
}
|
|
688
|
-
function
|
|
808
|
+
function N(e, t, n = "") {
|
|
689
809
|
if (!i.defined(e.bbox)) return t;
|
|
690
|
-
const
|
|
691
|
-
return
|
|
810
|
+
const r = at(e.bbox);
|
|
811
|
+
return r.valid || (t.valid = !1, t.errors.push(...r.errors.map((a) => ({ ...a, path: `${n}/bbox` })))), t.warnings.push(...r.warnings.map((a) => ({ ...a, path: `${n}/bbox` }))), t;
|
|
692
812
|
}
|
|
693
|
-
function
|
|
694
|
-
return i.arrayOfLengthAtLeast(e, t) ?
|
|
813
|
+
function W(e, t = 0, n = "") {
|
|
814
|
+
return i.arrayOfLengthAtLeast(e, t) ? L(e, C, n) : {
|
|
695
815
|
valid: !1,
|
|
696
|
-
errors: [{ message: `Invalid coordinates: must have at least ${t} positions`, path:
|
|
816
|
+
errors: [{ message: `Invalid coordinates: must have at least ${t} positions`, path: n }],
|
|
697
817
|
warnings: []
|
|
698
818
|
};
|
|
699
819
|
}
|
|
700
|
-
function
|
|
701
|
-
const
|
|
702
|
-
if (!
|
|
703
|
-
for (let
|
|
704
|
-
const
|
|
705
|
-
Math.abs(
|
|
706
|
-
message: `LineString crosses the antimeridian between positions ${
|
|
707
|
-
path: `${t}/${
|
|
820
|
+
function me(e, t = "") {
|
|
821
|
+
const n = W(e, 2, t);
|
|
822
|
+
if (!n.valid) return n;
|
|
823
|
+
for (let r = 0; r < e.length - 1; r++) {
|
|
824
|
+
const a = e[r][0], s = e[r + 1][0];
|
|
825
|
+
Math.abs(s - a) > 180 && n.warnings.push({
|
|
826
|
+
message: `LineString crosses the antimeridian between positions ${r} and ${r + 1}, consider using MultiLineString`,
|
|
827
|
+
path: `${t}/${r}`
|
|
708
828
|
});
|
|
709
829
|
}
|
|
710
|
-
return
|
|
830
|
+
return n;
|
|
711
831
|
}
|
|
712
|
-
function
|
|
713
|
-
return i.nonEmptyArray(e) ?
|
|
832
|
+
function ut(e, t = "") {
|
|
833
|
+
return i.nonEmptyArray(e) ? L(e, me, t) : {
|
|
714
834
|
valid: !1,
|
|
715
835
|
errors: [{ message: "Invalid MultiLineString: coordinates must be a non empty array", path: t }],
|
|
716
836
|
warnings: []
|
|
717
837
|
};
|
|
718
838
|
}
|
|
719
|
-
function
|
|
720
|
-
const
|
|
721
|
-
if (!
|
|
722
|
-
const
|
|
723
|
-
if (
|
|
724
|
-
return
|
|
725
|
-
const
|
|
726
|
-
|
|
727
|
-
const c =
|
|
728
|
-
return c.features.length > 0 && (
|
|
729
|
-
}
|
|
730
|
-
function
|
|
731
|
-
return i.nonEmptyArray(e) ?
|
|
839
|
+
function lt(e, t, n = "") {
|
|
840
|
+
const r = W(e, 4, n);
|
|
841
|
+
if (!r.valid) return r;
|
|
842
|
+
const a = e[0], s = e[e.length - 1];
|
|
843
|
+
if (a[0] !== s[0] || a[1] !== s[1])
|
|
844
|
+
return r.valid = !1, r.errors.push({ message: "Invalid LinearRing: first and last position must be identical", path: n }), r;
|
|
845
|
+
const m = ye(e) ? "clockwise" : "counter-clockwise";
|
|
846
|
+
m !== t && r.warnings.push({ message: `Ring must be ${t} but is ${m}`, path: n });
|
|
847
|
+
const c = Oe({ type: "Polygon", coordinates: [e] });
|
|
848
|
+
return c.features.length > 0 && (r.valid = !1, r.errors.push({ message: `Invalid LinearRing: ${c.features.length} self-intersection(s) detected`, path: n })), r;
|
|
849
|
+
}
|
|
850
|
+
function fe(e, t = "") {
|
|
851
|
+
return i.nonEmptyArray(e) ? L(e, (n, r, a) => lt(n, a === 0 ? "counter-clockwise" : "clockwise", r), t) : {
|
|
732
852
|
valid: !1,
|
|
733
853
|
errors: [{ message: "Invalid Polygon: coordinates must be a non empty array", path: t }],
|
|
734
854
|
warnings: []
|
|
735
855
|
};
|
|
736
856
|
}
|
|
737
|
-
function
|
|
738
|
-
return i.nonEmptyArray(e) ?
|
|
857
|
+
function ct(e, t = "") {
|
|
858
|
+
return i.nonEmptyArray(e) ? L(e, (n, r) => fe(n, r), t) : {
|
|
739
859
|
valid: !1,
|
|
740
860
|
errors: [{ message: "Invalid MultiPolygon: coordinates must be a non empty array", path: t }],
|
|
741
861
|
warnings: []
|
|
742
862
|
};
|
|
743
863
|
}
|
|
744
|
-
function
|
|
745
|
-
return i.nonEmptyArray(e) ?
|
|
864
|
+
function mt(e, t = "") {
|
|
865
|
+
return i.nonEmptyArray(e) ? L(e, (n, r) => X(n, r), t) : {
|
|
746
866
|
valid: !1,
|
|
747
867
|
errors: [{ message: "Invalid geometries: geometries must be a non empty array", path: t }],
|
|
748
868
|
warnings: []
|
|
749
869
|
};
|
|
750
870
|
}
|
|
751
|
-
function
|
|
871
|
+
function X(e, t = "") {
|
|
752
872
|
if (!i.nonEmptyObject(e))
|
|
753
873
|
return {
|
|
754
874
|
valid: !1,
|
|
755
875
|
errors: [{ message: "Invalid geometry: geometry must be a non empty object", path: t }],
|
|
756
876
|
warnings: []
|
|
757
877
|
};
|
|
758
|
-
const
|
|
759
|
-
let
|
|
878
|
+
const n = `${t}/coordinates`;
|
|
879
|
+
let r;
|
|
760
880
|
switch (e.type) {
|
|
761
|
-
case
|
|
762
|
-
const
|
|
763
|
-
|
|
764
|
-
valid:
|
|
765
|
-
errors:
|
|
766
|
-
warnings:
|
|
881
|
+
case g.POINT: {
|
|
882
|
+
const a = C(e.coordinates);
|
|
883
|
+
r = {
|
|
884
|
+
valid: a.valid,
|
|
885
|
+
errors: a.errors.map((s) => ({ ...s, path: n })),
|
|
886
|
+
warnings: a.warnings.map((s) => ({ ...s, path: n }))
|
|
767
887
|
};
|
|
768
888
|
break;
|
|
769
889
|
}
|
|
770
|
-
case
|
|
771
|
-
|
|
890
|
+
case g.MULTI_POINT: {
|
|
891
|
+
r = W(e.coordinates, 0, n);
|
|
772
892
|
break;
|
|
773
893
|
}
|
|
774
|
-
case
|
|
775
|
-
|
|
894
|
+
case g.LINESTRING: {
|
|
895
|
+
r = me(e.coordinates, n);
|
|
776
896
|
break;
|
|
777
897
|
}
|
|
778
|
-
case
|
|
779
|
-
|
|
898
|
+
case g.MULTI_LINESTRING: {
|
|
899
|
+
r = ut(e.coordinates, n);
|
|
780
900
|
break;
|
|
781
901
|
}
|
|
782
|
-
case
|
|
783
|
-
|
|
902
|
+
case g.POLYGON: {
|
|
903
|
+
r = fe(e.coordinates, n);
|
|
784
904
|
break;
|
|
785
905
|
}
|
|
786
|
-
case
|
|
787
|
-
|
|
906
|
+
case g.MULTI_POLYGON: {
|
|
907
|
+
r = ct(e.coordinates, n);
|
|
788
908
|
break;
|
|
789
909
|
}
|
|
790
|
-
case
|
|
791
|
-
|
|
910
|
+
case g.GEOMETRY_COLLECTION: {
|
|
911
|
+
r = mt(e.geometries, `${t}/geometries`);
|
|
792
912
|
break;
|
|
793
913
|
}
|
|
794
914
|
default:
|
|
@@ -798,7 +918,7 @@ function j(e, t = "") {
|
|
|
798
918
|
warnings: []
|
|
799
919
|
};
|
|
800
920
|
}
|
|
801
|
-
return
|
|
921
|
+
return r = N(e, r, t), r.statistics = { geometries: { [e.type]: 1 } }, r;
|
|
802
922
|
}
|
|
803
923
|
function ge(e, t = "") {
|
|
804
924
|
if (!i.nonEmptyObject(e))
|
|
@@ -806,18 +926,18 @@ function ge(e, t = "") {
|
|
|
806
926
|
valid: !1,
|
|
807
927
|
errors: [{ message: "Invalid feature: must be a non empty object", path: t }],
|
|
808
928
|
warnings: [],
|
|
809
|
-
statistics:
|
|
929
|
+
statistics: T()
|
|
810
930
|
};
|
|
811
|
-
if (e.type ===
|
|
931
|
+
if (e.type === h.FEATURE) {
|
|
812
932
|
if (i.nonEmptyObject(e.geometry)) {
|
|
813
|
-
const
|
|
933
|
+
const n = X(e.geometry, `${t}/geometry`);
|
|
814
934
|
return {
|
|
815
|
-
...
|
|
935
|
+
...N(e, n, t),
|
|
816
936
|
statistics: {
|
|
817
937
|
Feature: 1,
|
|
818
938
|
FeatureCollection: 0,
|
|
819
939
|
// Geometry counting is owned by validateGeometry.
|
|
820
|
-
geometries: { ...
|
|
940
|
+
geometries: { ...n.statistics.geometries }
|
|
821
941
|
}
|
|
822
942
|
};
|
|
823
943
|
}
|
|
@@ -828,104 +948,112 @@ function ge(e, t = "") {
|
|
|
828
948
|
statistics: { Feature: 1, FeatureCollection: 0, geometries: {} }
|
|
829
949
|
};
|
|
830
950
|
}
|
|
831
|
-
if (e.type ===
|
|
951
|
+
if (e.type === h.FEATURE_COLLECTION) {
|
|
832
952
|
if (i.nonEmptyArray(e.features)) {
|
|
833
|
-
const
|
|
953
|
+
const n = L(e.features, ge, `${t}/features`);
|
|
834
954
|
return {
|
|
835
|
-
...
|
|
836
|
-
statistics: { ...
|
|
955
|
+
...N(e, n, t),
|
|
956
|
+
statistics: { ...n.statistics, FeatureCollection: n.statistics.FeatureCollection + 1 }
|
|
837
957
|
};
|
|
838
958
|
}
|
|
839
959
|
return {
|
|
840
960
|
valid: !1,
|
|
841
961
|
errors: [{ message: "Invalid FeatureCollection: features must be a non empty array", path: t }],
|
|
842
962
|
warnings: [],
|
|
843
|
-
statistics:
|
|
963
|
+
statistics: T()
|
|
844
964
|
};
|
|
845
965
|
}
|
|
846
966
|
return {
|
|
847
967
|
valid: !1,
|
|
848
968
|
errors: [{ message: `Invalid feature: unknown type: ${e.type}`, path: t }],
|
|
849
969
|
warnings: [],
|
|
850
|
-
statistics:
|
|
970
|
+
statistics: T()
|
|
851
971
|
};
|
|
852
972
|
}
|
|
853
|
-
function
|
|
854
|
-
if (u.that(e, i.nonEmptyObject, "geojson must be a non empty object"), i.oneOf(e.type, Object.values(
|
|
855
|
-
const t =
|
|
973
|
+
function Bt(e) {
|
|
974
|
+
if (u.that(e, i.nonEmptyObject, "geojson must be a non empty object"), i.oneOf(e.type, Object.values(g))) {
|
|
975
|
+
const t = X(e, ""), n = N(e, t, "");
|
|
856
976
|
return {
|
|
857
|
-
...
|
|
977
|
+
...te(e, n),
|
|
858
978
|
// Geometry counting is owned by validateGeometry.
|
|
859
979
|
statistics: { Feature: 0, FeatureCollection: 0, geometries: { ...t.statistics.geometries } }
|
|
860
980
|
};
|
|
861
981
|
}
|
|
862
|
-
if (e.type ===
|
|
982
|
+
if (e.type === h.FEATURE || e.type === h.FEATURE_COLLECTION) {
|
|
863
983
|
const t = ge(e, "");
|
|
864
|
-
return
|
|
984
|
+
return te(e, t);
|
|
865
985
|
}
|
|
866
986
|
return {
|
|
867
987
|
valid: !1,
|
|
868
988
|
errors: [{ message: "Invalid GeoJson: type must be either a Geometry, a Feature or a FeatureCollection", path: "" }],
|
|
869
989
|
warnings: [],
|
|
870
|
-
statistics:
|
|
990
|
+
statistics: T()
|
|
871
991
|
};
|
|
872
992
|
}
|
|
873
993
|
export {
|
|
874
994
|
d as AXES,
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
995
|
+
P as COORDINATE_FORMATS,
|
|
996
|
+
Ye as COORDINATE_MODELS,
|
|
997
|
+
Y as COORDINATE_TRUNCATION_FACTORS,
|
|
998
|
+
M as CRS_TYPES,
|
|
999
|
+
h as FEATURE_TYPES,
|
|
1000
|
+
g as GEOMETRY_TYPES,
|
|
1001
|
+
x as computeBBox,
|
|
1002
|
+
kt as computeGeoJsonBoundingBox,
|
|
1003
|
+
nt as computeGeoJsonConvexHull,
|
|
1004
|
+
Nt as convertCoordinate,
|
|
1005
|
+
re as getActiveLocales,
|
|
1006
|
+
j as getAllDirectionSymbols,
|
|
1007
|
+
J as getCoordinatePrecision,
|
|
1008
|
+
Ne as getDirectionAxis,
|
|
1009
|
+
St as getDirections,
|
|
1010
|
+
Rt as getEast,
|
|
1011
|
+
Ae as getLatitudeSymbols,
|
|
1012
|
+
Re as getLocale,
|
|
1013
|
+
B as getLocaleByCode,
|
|
1014
|
+
Me as getLongitudeSymbols,
|
|
1015
|
+
bt as getNorth,
|
|
1016
|
+
Dt as getSouth,
|
|
1017
|
+
At as getWest,
|
|
1018
|
+
Z as guessCoordinateAxis,
|
|
1019
|
+
ee as is3DBBox,
|
|
1020
|
+
Xe as is3DPosition,
|
|
1021
|
+
Ot as isAltitude,
|
|
1022
|
+
Te as isAxis,
|
|
1023
|
+
O as isDirection,
|
|
1024
|
+
V as isEast,
|
|
1025
|
+
k as isLatitude,
|
|
1026
|
+
Gt as isLikeBBox,
|
|
1027
|
+
xt as isLikeCRS,
|
|
1028
|
+
Qe as isLikeFeature,
|
|
1029
|
+
Ze as isLikeFeatureCollection,
|
|
1030
|
+
Je as isLikeFeatureOrFeatureCollection,
|
|
1031
|
+
F as isLikeGeoJson,
|
|
1032
|
+
qe as isLikeGeometry,
|
|
1033
|
+
Ut as isLikePosition,
|
|
1034
|
+
ne as isLongitude,
|
|
1035
|
+
Ce as isNorth,
|
|
1036
|
+
_t as isSamePosition,
|
|
1037
|
+
ie as isSouth,
|
|
1038
|
+
A as isValidBBox,
|
|
1039
|
+
y as isValidPosition,
|
|
1040
|
+
$ as isWest,
|
|
1041
|
+
Tt as listLocales,
|
|
1042
|
+
Ft as mergeBBox,
|
|
1043
|
+
Ct as normalizeCoordinate,
|
|
1044
|
+
We as parseCoordinate,
|
|
1045
|
+
wt as parsePosition,
|
|
1046
|
+
It as registerLocale,
|
|
1047
|
+
Lt as setLocale,
|
|
1048
|
+
G as simplifyGeoJson,
|
|
1049
|
+
ue as truncateBBox,
|
|
1050
|
+
Mt as truncateCoordinate,
|
|
1051
|
+
Pt as truncateGeoJson,
|
|
1052
|
+
$t as truncatePosition,
|
|
1053
|
+
at as validateBBox,
|
|
1054
|
+
st as validateCRS,
|
|
1055
|
+
Bt as validateGeoJson,
|
|
1056
|
+
X as validateGeometry,
|
|
1057
|
+
C as validatePosition
|
|
930
1058
|
};
|
|
931
1059
|
//# sourceMappingURL=index.mjs.map
|