@konfirm/geojson 1.0.0 → 1.0.1-beta.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.
Files changed (127) hide show
  1. package/README.md +7 -7
  2. package/dist/{geojson.d.ts → main.d.mts} +18 -79
  3. package/dist/main.d.ts +137 -15
  4. package/dist/main.global.js +853 -0
  5. package/dist/main.global.js.map +1 -0
  6. package/dist/main.js +824 -0
  7. package/dist/main.js.map +1 -0
  8. package/dist/main.mjs +772 -0
  9. package/dist/main.mjs.map +1 -0
  10. package/package.json +101 -63
  11. package/.editorconfig +0 -16
  12. package/.github/workflows/release.yml +0 -21
  13. package/.github/workflows/tests.yml +0 -56
  14. package/CHANGELOG.md +0 -21
  15. package/dist/Domain/Constants.d.ts +0 -5
  16. package/dist/Domain/GeoJSON/Concept/Altitude.d.ts +0 -3
  17. package/dist/Domain/GeoJSON/Concept/BoundingBox.d.ts +0 -6
  18. package/dist/Domain/GeoJSON/Concept/ExteriorRing.d.ts +0 -4
  19. package/dist/Domain/GeoJSON/Concept/GeoJSONObject.d.ts +0 -11
  20. package/dist/Domain/GeoJSON/Concept/InteriorRing.d.ts +0 -4
  21. package/dist/Domain/GeoJSON/Concept/Latitude.d.ts +0 -3
  22. package/dist/Domain/GeoJSON/Concept/LinearRing.d.ts +0 -4
  23. package/dist/Domain/GeoJSON/Concept/Longitude.d.ts +0 -3
  24. package/dist/Domain/GeoJSON/Concept/Position.d.ts +0 -7
  25. package/dist/Domain/GeoJSON/Feature.d.ts +0 -12
  26. package/dist/Domain/GeoJSON/FeatureCollection.d.ts +0 -8
  27. package/dist/Domain/GeoJSON/GeoJSON.d.ts +0 -7
  28. package/dist/Domain/GeoJSON/Geometry/LineString.d.ts +0 -11
  29. package/dist/Domain/GeoJSON/Geometry/MultiLineString.d.ts +0 -7
  30. package/dist/Domain/GeoJSON/Geometry/MultiPoint.d.ts +0 -8
  31. package/dist/Domain/GeoJSON/Geometry/MultiPolygon.d.ts +0 -7
  32. package/dist/Domain/GeoJSON/Geometry/Point.d.ts +0 -11
  33. package/dist/Domain/GeoJSON/Geometry/Polygon.d.ts +0 -11
  34. package/dist/Domain/GeoJSON/Geometry.d.ts +0 -9
  35. package/dist/Domain/GeoJSON/GeometryCollection.d.ts +0 -8
  36. package/dist/Domain/GeoJSON/GeometryObject.d.ts +0 -12
  37. package/dist/Domain/Guards/Number.d.ts +0 -3
  38. package/dist/Domain/Guards/Tuple.d.ts +0 -3
  39. package/dist/Domain/Iterator/IterablePair.d.ts +0 -32
  40. package/dist/Domain/Iterator/SimpleGeometry.d.ts +0 -90
  41. package/dist/Domain/Utility/Calculate.d.ts +0 -9
  42. package/dist/Domain/Utility/Distance.d.ts +0 -3
  43. package/dist/Domain/Utility/Intersect.d.ts +0 -2
  44. package/dist/Domain/Utility/Segments.d.ts +0 -2
  45. package/dist/Domain/Utility/Winding.d.ts +0 -3
  46. package/dist/geojson.cjs.js +0 -655
  47. package/dist/geojson.cjs.min.js +0 -1
  48. package/dist/geojson.es.js +0 -627
  49. package/dist/geojson.es.min.js +0 -1
  50. package/dist/geojson.js +0 -660
  51. package/dist/geojson.min.js +0 -1
  52. package/rollup.config.mjs +0 -43
  53. package/source/Domain/Constants.ts +0 -5
  54. package/source/Domain/GeoJSON/Concept/Altitude.ts +0 -9
  55. package/source/Domain/GeoJSON/Concept/BoundingBox.ts +0 -31
  56. package/source/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -12
  57. package/source/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -23
  58. package/source/Domain/GeoJSON/Concept/InteriorRing.ts +0 -12
  59. package/source/Domain/GeoJSON/Concept/Latitude.ts +0 -7
  60. package/source/Domain/GeoJSON/Concept/LinearRing.ts +0 -14
  61. package/source/Domain/GeoJSON/Concept/Longitude.ts +0 -7
  62. package/source/Domain/GeoJSON/Concept/Position.ts +0 -18
  63. package/source/Domain/GeoJSON/Feature.ts +0 -24
  64. package/source/Domain/GeoJSON/FeatureCollection.ts +0 -16
  65. package/source/Domain/GeoJSON/GeoJSON.ts +0 -9
  66. package/source/Domain/GeoJSON/Geometry/LineString.ts +0 -12
  67. package/source/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -9
  68. package/source/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -10
  69. package/source/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -9
  70. package/source/Domain/GeoJSON/Geometry/Point.ts +0 -12
  71. package/source/Domain/GeoJSON/Geometry/Polygon.ts +0 -20
  72. package/source/Domain/GeoJSON/Geometry.ts +0 -11
  73. package/source/Domain/GeoJSON/GeometryCollection.ts +0 -23
  74. package/source/Domain/GeoJSON/GeometryObject.ts +0 -20
  75. package/source/Domain/Guards/Number.ts +0 -13
  76. package/source/Domain/Guards/Tuple.ts +0 -6
  77. package/source/Domain/Guards/Utility.ts +0 -1
  78. package/source/Domain/Iterator/IterablePair.ts +0 -47
  79. package/source/Domain/Iterator/SimpleGeometry.ts +0 -137
  80. package/source/Domain/Utility/Calculate.ts +0 -143
  81. package/source/Domain/Utility/Distance.ts +0 -56
  82. package/source/Domain/Utility/Intersect.ts +0 -42
  83. package/source/Domain/Utility/Numeric.ts +0 -8
  84. package/source/Domain/Utility/Segments.ts +0 -5
  85. package/source/Domain/Utility/Winding.ts +0 -19
  86. package/source/main.ts +0 -20
  87. package/test/Domain/GeoJSON/Concept/Altitude.ts +0 -58
  88. package/test/Domain/GeoJSON/Concept/BoundingBox.ts +0 -77
  89. package/test/Domain/GeoJSON/Concept/ExteriorRing.ts +0 -65
  90. package/test/Domain/GeoJSON/Concept/GeoJSONObject.ts +0 -56
  91. package/test/Domain/GeoJSON/Concept/InteriorRing.ts +0 -65
  92. package/test/Domain/GeoJSON/Concept/Latitude.ts +0 -56
  93. package/test/Domain/GeoJSON/Concept/LinearRing.ts +0 -63
  94. package/test/Domain/GeoJSON/Concept/Longitude.ts +0 -56
  95. package/test/Domain/GeoJSON/Concept/Position.ts +0 -56
  96. package/test/Domain/GeoJSON/Feature.ts +0 -9
  97. package/test/Domain/GeoJSON/FeatureCollection.ts +0 -9
  98. package/test/Domain/GeoJSON/GeoJSON.ts +0 -21
  99. package/test/Domain/GeoJSON/Geometry/LineString.ts +0 -11
  100. package/test/Domain/GeoJSON/Geometry/MultiLineString.ts +0 -11
  101. package/test/Domain/GeoJSON/Geometry/MultiPoint.ts +0 -11
  102. package/test/Domain/GeoJSON/Geometry/MultiPolygon.ts +0 -11
  103. package/test/Domain/GeoJSON/Geometry/Point.ts +0 -11
  104. package/test/Domain/GeoJSON/Geometry/Polygon.ts +0 -11
  105. package/test/Domain/GeoJSON/Geometry.ts +0 -9
  106. package/test/Domain/GeoJSON/GeometryCollection.ts +0 -9
  107. package/test/Domain/GeoJSON/GeometryObject.ts +0 -4
  108. package/test/Domain/Guards/Number.ts +0 -49
  109. package/test/Domain/Guards/Tuple.ts +0 -27
  110. package/test/Domain/Iterator/IterablePair.ts +0 -203
  111. package/test/Domain/Iterator/SimpleGeometry.ts +0 -195
  112. package/test/Domain/Utility/Calculate.ts +0 -178
  113. package/test/Domain/Utility/Distance.ts +0 -19
  114. package/test/Domain/Utility/Intersect.ts +0 -54
  115. package/test/Domain/Utility/Numeric.ts +0 -30
  116. package/test/Domain/Utility/Winding.ts +0 -52
  117. package/test/README.ts +0 -123
  118. package/test/data/Distance.ts +0 -51
  119. package/test/data/HolySee.ts +0 -74
  120. package/test/data/Intersect.ts +0 -300
  121. package/test/data/Italy.ts +0 -2883
  122. package/test/data/SanMarino.ts +0 -83
  123. package/test/data/Shapes.ts +0 -107
  124. package/test/helper/geometry.ts +0 -76
  125. package/test/helper/malform.ts +0 -82
  126. package/test/main.ts +0 -4
  127. package/tsconfig.json +0 -12
@@ -1,627 +0,0 @@
1
- function segments(line) {
2
- return line.slice(1).map((point, index) => [line[index], point]);
3
- }
4
-
5
- const EARTH_RADIUS = 6371008.7714; // mean radius
6
- const EARTH_RADIUS_MAJOR = 6378137; // equatorial radius
7
- const EARTH_RADIUS_MINOR = 6356752.314245; // semiminor axis
8
- const EARTH_FLATTENING = 298.257223563;
9
- const GPS_SATELLITE_ORBIT = 20180000;
10
-
11
- const D2R = Math.PI / 180;
12
- const π = Math.PI;
13
- function constrain(value, min, max) {
14
- return Math.max(Math.min(value, max), min);
15
- }
16
- function squared(n) {
17
- return n * n;
18
- }
19
- function rad(n) {
20
- return n * D2R;
21
- }
22
- const EARTH_RADIUS_MAJOR_SQUARED = squared(EARTH_RADIUS_MAJOR);
23
- const EARTH_RADIUS_MINOR_SQUARED = squared(EARTH_RADIUS_MINOR);
24
- const EARTH_RADIUS_FACTOR = (EARTH_RADIUS_MAJOR_SQUARED - EARTH_RADIUS_MINOR_SQUARED) / EARTH_RADIUS_MINOR_SQUARED;
25
- const EARTH_INVERSE_FLATTENING = 1 / EARTH_FLATTENING;
26
- const PointToPoint = {
27
- cartesian([λa, φa], [λb, φb]) {
28
- return EARTH_RADIUS * rad(Math.sqrt(squared(λb - λa) + squared(φb - φa)));
29
- },
30
- haversine([λa, φa], [λb, φb]) {
31
- //https://www.movable-type.co.uk/scripts/latlong.html
32
- const Δ = squared(Math.sin(rad(φb - φa) / 2)) + Math.cos(rad(φa)) * Math.cos(rad(φb)) * squared(Math.sin(rad(λb - λa) / 2));
33
- return EARTH_RADIUS * Math.atan2(Math.sqrt(Δ), Math.sqrt(1 - Δ)) * 2;
34
- },
35
- vincenty(...points) {
36
- //https://www.movable-type.co.uk/scripts/latlong-vincenty.html
37
- const [[λ1, φ1], [λ2, φ2]] = points.map((p) => p.map(rad));
38
- const L = λ2 - λ1; // L = difference in longitude, U = reduced latitude, defined by tan U = (1-f)·tanφ.
39
- const tanU1 = (1 - EARTH_INVERSE_FLATTENING) * Math.tan(φ1), cosU1 = 1 / Math.sqrt((1 + tanU1 * tanU1)), sinU1 = tanU1 * cosU1;
40
- const tanU2 = (1 - EARTH_INVERSE_FLATTENING) * Math.tan(φ2), cosU2 = 1 / Math.sqrt((1 + tanU2 * tanU2)), sinU2 = tanU2 * cosU2;
41
- const antipodal = Math.abs(L) > π / 2 || Math.abs(φ2 - φ1) > π / 2;
42
- let λ = L;
43
- let sinλ = null;
44
- let cosλ = null; // λ = difference in longitude on an auxiliary sphere
45
- let σ = antipodal ? π : 0;
46
- let sinσ = 0;
47
- let cosσ = antipodal ? -1 : 1;
48
- let sinSqσ = null; // σ = angular distance P₁ P₂ on the sphere
49
- let cos2σₘ = 1; // σₘ = angular distance on the sphere from the equator to the midpoint of the line
50
- let cosSqα = 1; // α = azimuth of the geodesic at the equator
51
- let λʹ = null;
52
- let iterations = 0;
53
- do {
54
- sinλ = Math.sin(λ);
55
- cosλ = Math.cos(λ);
56
- sinSqσ = (cosU2 * sinλ) ** 2 + (cosU1 * sinU2 - sinU1 * cosU2 * cosλ) ** 2;
57
- if (Math.abs(sinSqσ) < 1e-24)
58
- break; // co-incident/antipodal points (σ < ≈0.006mm)
59
- sinσ = Math.sqrt(sinSqσ);
60
- cosσ = sinU1 * sinU2 + cosU1 * cosU2 * cosλ;
61
- σ = Math.atan2(sinσ, cosσ);
62
- const sinα = cosU1 * cosU2 * sinλ / sinσ;
63
- cosSqα = 1 - sinα * sinα;
64
- cos2σₘ = (cosSqα != 0) ? (cosσ - 2 * sinU1 * sinU2 / cosSqα) : 0; // on equatorial line cos²α = 0 (§6)
65
- const C = EARTH_INVERSE_FLATTENING / 16 * cosSqα * (4 + EARTH_INVERSE_FLATTENING * (4 - 3 * cosSqα));
66
- λʹ = λ;
67
- λ = L + (1 - C) * EARTH_INVERSE_FLATTENING * sinα * (σ + C * sinσ * (cos2σₘ + C * cosσ * (-1 + 2 * cos2σₘ * cos2σₘ)));
68
- // TODO: add tests
69
- // const iterationCheck = antipodal ? Math.abs(λ) - π : Math.abs(λ);
70
- // if (iterationCheck > π) throw new EvalError('λ > π');
71
- } while (Math.abs(λ - λʹ) > 1e-12 && ++iterations < 1000); // TV: 'iterate until negligible change in λ' (≈0.006mm)
72
- // TODO: add tests
73
- // if (iterations >= 1000) throw new EvalError('Vincenty formula failed to converge');
74
- const uSq = cosSqα * EARTH_RADIUS_FACTOR;
75
- const A = 1 + uSq / 16384 * (4096 + uSq * (-768 + uSq * (320 - 175 * uSq)));
76
- const B = uSq / 1024 * (256 + uSq * (-128 + uSq * (74 - 47 * uSq)));
77
- const Δσ = B * sinσ * (cos2σₘ + B / 4 * (cosσ * (-1 + 2 * cos2σₘ * cos2σₘ) - B / 6 * cos2σₘ * (-3 + 4 * sinσ * sinσ) * (-3 + 4 * cos2σₘ * cos2σₘ)));
78
- return EARTH_RADIUS_MINOR * A * (σ - Δσ);
79
- },
80
- };
81
- function getClosestPointOnLineByPoint(point, line) {
82
- const [[px, py], [ax, ay], [bx, by]] = [point, ...line];
83
- const [abx, aby] = [bx - ax, by - ay];
84
- const [apx, apy] = [px - ax, py - ay];
85
- const t = constrain((apx * abx + apy * aby) / (abx * abx + aby * aby), 0, 1);
86
- return t === 0 || t === 1 ? line[t] : [ax + abx * t, ay + aby * t];
87
- }
88
- function getDistanceOfPointToPoint(a, b, calculation) {
89
- const calc = typeof calculation === 'function' ? calculation : PointToPoint[calculation];
90
- if (typeof calc === 'function') {
91
- return calc(a, b);
92
- }
93
- throw new Error(`Not a PointToPoint calculation function ${calculation}`);
94
- }
95
- function getDistanceOfPointToLine(point, line, calculation) {
96
- return getDistanceOfPointToPoint(point, getClosestPointOnLineByPoint(point, line), calculation);
97
- }
98
- function getDistanceOfLineToLine(a, b, calculation) {
99
- return isLinesCrossing(a, b)
100
- ? 0
101
- : Math.min(...a.map((a) => getDistanceOfPointToLine(a, b, calculation)), ...b.map((b) => getDistanceOfPointToLine(b, a, calculation)));
102
- }
103
- function isLinesCrossing(a, b) {
104
- const [[a1x, a1y], [a2x, a2y]] = a;
105
- const [[b1x, b1y], [b2x, b2y]] = b;
106
- const [s1x, s1y, s2x, s2y] = [a2x - a1x, a2y - a1y, b2x - b1x, b2y - b1y];
107
- const s = (-s1y * (a1x - b1x) + s1x * (a1y - b1y)) / (-s2x * s1y + s1x * s2y);
108
- const t = (s2x * (a1y - b1y) - s2y * (a1x - b1x)) / (-s2x * s1y + s1x * s2y);
109
- return s >= 0 && s <= 1 && t >= 0 && t <= 1;
110
- }
111
- function isPointOnLine(point, line, threshold = 1e-14) {
112
- return getDistanceOfPointToLine(point, line, 'cartesian') < threshold;
113
- }
114
- function isPointInRing(p, ring) {
115
- const { length } = ring;
116
- const odd = ring
117
- .reduce((odd, a, i) => {
118
- const b = ring[(length + i - 1) % length];
119
- return (a[1] < p[1] && b[1] >= p[1] || b[1] < p[1] && a[1] >= p[1]) && (a[0] <= p[0] || b[0] <= p[0])
120
- ? odd ^ Number(a[0] + (p[1] - a[1]) / (b[1] - a[1]) * (b[0] - a[0]) < p[0])
121
- : odd;
122
- }, 0);
123
- return odd !== 0 || ring.slice(1).some((a, index) => isPointOnLine(p, [ring[index], a]));
124
- }
125
-
126
- /**
127
- * Iterator class to turn any GeoJSON structure into one or more SimpleGeometry (Point | LineString | Polygon) objects
128
- *
129
- * @export
130
- * @class SimpleGeometryIterator
131
- */
132
- class SimpleGeometryIterator {
133
- /**
134
- * Creates an instance of SimpleGeometryIterator
135
- *
136
- * @param {...[GeoJSON, ...Array<GeoJSON>]} inputs
137
- * @memberof SimpleGeometryIterator
138
- */
139
- constructor(...inputs) {
140
- this.inputs = [];
141
- this.inputs = inputs;
142
- }
143
- /**
144
- * Generator yielding all SimpleGeometry objects from the provided GeoJSON structure(s)
145
- *
146
- * @return {*} {Iterator<SimpleGeometry>}
147
- * @memberof SimpleGeometryIterator
148
- */
149
- *[Symbol.iterator]() {
150
- for (const input of this.inputs) {
151
- for (const simple of this.unwrap(input)) {
152
- yield simple;
153
- }
154
- }
155
- }
156
- /**
157
- * unwrap any GeoJSON object into one or more SimpleGeometry object
158
- *
159
- * @private
160
- * @param {GeoJSON} geo
161
- * @return {*} {Iterable<SimpleGeometry>}
162
- * @memberof SimpleGeometryIterator
163
- */
164
- *unwrap(geo) {
165
- geo.type in this
166
- ? yield* this[geo.type](geo)
167
- : yield geo;
168
- }
169
- /**
170
- * Generate the geometries in a GeometryCollection
171
- *
172
- * @private
173
- * @param {GeometryCollection} { geometries }
174
- * @return {*} {Iterable<SimpleGeometry>}
175
- * @memberof SimpleGeometryIterator
176
- */
177
- *GeometryCollection({ geometries }) {
178
- for (const geometry of geometries) {
179
- yield* this.unwrap(geometry);
180
- }
181
- }
182
- /**
183
- * Generate the geometries of the Feature object(s) in a FeatureCollection
184
- *
185
- * @private
186
- * @param {FeatureCollection} { features }
187
- * @return {*} {Iterable<SimpleGeometry>}
188
- * @memberof SimpleGeometryIterator
189
- */
190
- *FeatureCollection({ features }) {
191
- for (const { geometry } of features) {
192
- yield* this.unwrap(geometry);
193
- }
194
- }
195
- /**
196
- * Generate the geometry of a Feature object
197
- *
198
- * @private
199
- * @param {Feature} { geometry }
200
- * @return {*} {Iterable<SimpleGeometry>}
201
- * @memberof SimpleGeometryIterator
202
- */
203
- *Feature({ geometry }) {
204
- yield* this.unwrap(geometry);
205
- }
206
- /**
207
- * Generate Point objects from a MultiPoint object
208
- *
209
- * @private
210
- * @param {MultiPoint} multi
211
- * @return {*} {Iterable<Point>}
212
- * @memberof SimpleGeometryIterator
213
- */
214
- *MultiPoint(multi) {
215
- for (const coordinates of multi.coordinates) {
216
- yield { type: 'Point', coordinates };
217
- }
218
- }
219
- /**
220
- * Generate LineString objects from a MultiLineString object
221
- *
222
- * @private
223
- * @param {MultiLineString} multi
224
- * @return {*} {Iterable<LineString>}
225
- * @memberof SimpleGeometryIterator
226
- */
227
- *MultiLineString(multi) {
228
- for (const coordinates of multi.coordinates) {
229
- yield { type: 'LineString', coordinates };
230
- }
231
- }
232
- /**
233
- * Generate Polygon objects from a MultiPolygon object
234
- *
235
- * @private
236
- * @param {MultiPolygon} multi
237
- * @return {*} {Iterable<Polygon>}
238
- * @memberof SimpleGeometryIterator
239
- */
240
- *MultiPolygon(multi) {
241
- for (const coordinates of multi.coordinates) {
242
- yield { type: 'Polygon', coordinates };
243
- }
244
- }
245
- }
246
-
247
- /**
248
- * Iterator class which traverses all value pairs of two or more Iterable instances
249
- *
250
- * @export
251
- * @class IterablePairIterator
252
- * @template T
253
- */
254
- class IterablePairIterator {
255
- /**
256
- * Constructs a new instance of IterablePairIterator
257
- *
258
- * @param iterators
259
- */
260
- constructor(...iterators) {
261
- this.iterators = [];
262
- this.iterators = iterators;
263
- }
264
- /**
265
- * Generator yielding all value pairs from the provided iterators
266
- *
267
- * @return {*} {Iterator<[T, T]>}
268
- * @memberof IterablePairIterator
269
- */
270
- *[Symbol.iterator]() {
271
- for (const [a, b] of this.pairs(this.iterators)) {
272
- for (const one of a) {
273
- for (const two of b) {
274
- yield [one, two];
275
- }
276
- }
277
- }
278
- }
279
- /**
280
- * Create unique Iterator<T> combinations to traverse over
281
- *
282
- * @private
283
- * @param {Array<Iterable<T>>} source
284
- * @return {*} {Array<[Iterable<T>, Iterable<T>]>}
285
- * @memberof IterablePairIterator
286
- */
287
- pairs(source) {
288
- return source.map((a, i) => source.slice(i + 1).map((b) => [a, b])).flat();
289
- }
290
- }
291
-
292
- const geometries$1 = {
293
- PointPoint(a, b) {
294
- return a.length >= 2 && b.length >= 2 && a.slice(0, 2).every((v, i) => v === b[i]);
295
- },
296
- LineStringPoint(a, b) {
297
- return a.some((a) => this.PointPoint(a, b)) || segments(a).some((line) => isPointOnLine(b, line));
298
- },
299
- LineStringLineString(a, b) {
300
- const lines = segments(b);
301
- return segments(a).some((a) => lines.some((b) => isLinesCrossing(a, b)));
302
- },
303
- PolygonPoint([exterior, ...interior], b) {
304
- return (this.LineStringPoint(exterior, b) || isPointInRing(b, exterior)) && (!interior.length || interior.every((ring) => !isPointInRing(b, ring)));
305
- },
306
- PolygonLineString(a, b) {
307
- return a.some((ring) => this.LineStringLineString(ring, b)) || b.some((point) => this.PolygonPoint(a, point));
308
- },
309
- PolygonPolygon(a, b) {
310
- return b.some((b1) => this.PolygonLineString(a, b1) || b1.some((b2) => this.PolygonPoint(a, b2)))
311
- || a.some((a1) => this.PolygonLineString(b, a1) || a1.some((a2) => this.PolygonPoint(b, a2)));
312
- },
313
- };
314
- function intersect(a, b) {
315
- for (const [itA, itB] of new IterablePairIterator(new SimpleGeometryIterator(a), new SimpleGeometryIterator(b))) {
316
- if ((itA.type + itB.type in geometries$1 && geometries$1[itA.type + itB.type](itA.coordinates, itB.coordinates)) || (itB.type + itA.type in geometries$1 && geometries$1[itB.type + itA.type](itB.coordinates, itA.coordinates))) {
317
- return true;
318
- }
319
- }
320
- return false;
321
- }
322
-
323
- const geometries = {
324
- PointPoint(a, b, calculation) {
325
- return getDistanceOfPointToPoint(a, b, calculation);
326
- },
327
- LineStringPoint(a, b, calculation) {
328
- return Math.min(...segments(a).map((line) => getDistanceOfPointToLine(b, line, calculation)));
329
- },
330
- LineStringLineString(a, b, calculation) {
331
- const sa = segments(a);
332
- const sb = segments(b);
333
- return sa.reduce((carry, a) => sb.reduce((carry, b) => carry > 0 ? Math.min(carry, getDistanceOfLineToLine(a, b, calculation)) : carry, carry), Infinity);
334
- },
335
- PolygonPoint([exterior, ...interior], b, calculation) {
336
- if (isPointInRing(b, exterior)) {
337
- const [excluded] = interior.filter((ring) => isPointInRing(b, ring));
338
- return excluded ? this.LineStringPoint(excluded, b, calculation) : 0;
339
- }
340
- return this.LineStringPoint(exterior, b, calculation);
341
- },
342
- PolygonLineString(a, b, calculation) {
343
- const [exterior, ...interior] = a;
344
- const line = segments(b);
345
- const ring = b.some((b) => isPointInRing(b, exterior))
346
- ? interior.find((a) => b.every((b) => isPointInRing(b, a)))
347
- : exterior;
348
- return ring
349
- ? Math.min(...segments(ring).map((a) => Math.min(...line.map((b) => getDistanceOfLineToLine(a, b, calculation)))))
350
- : 0;
351
- },
352
- PolygonPolygon(a, b, calculation) {
353
- return Math.min(this.PolygonLineString(a, b[0], calculation), this.PolygonLineString(b, a[0], calculation));
354
- },
355
- };
356
- function distance(a, b, calculation = 'cartesian') {
357
- return Math.min(...[...new IterablePairIterator(new SimpleGeometryIterator(a), new SimpleGeometryIterator(b))].map(([a, b]) => {
358
- return a.type + b.type in geometries
359
- ? geometries[a.type + b.type](a.coordinates, b.coordinates, calculation)
360
- : b.type + a.type in geometries
361
- ? geometries[b.type + a.type](b.coordinates, a.coordinates, calculation)
362
- : Infinity;
363
- }));
364
- }
365
-
366
- class TypeMapper {
367
- constructor(mapping = {}) {
368
- this.mapping = Object.keys(mapping)
369
- .map((key) => (value) => mapping[key](value) ? key : undefined)
370
- .concat((value) => typeof value);
371
- }
372
- map(value) {
373
- return this.mapping.reduce((carry, map) => carry || map(value), undefined);
374
- }
375
- }
376
-
377
- class ValueMapper {
378
- constructor(types = new TypeMapper(), mapping = {}) {
379
- this.types = types;
380
- this.mapping = mapping;
381
- }
382
- map(value) {
383
- const type = this.types.map(value);
384
- const map = (value) => this.map(value);
385
- return type in this.mapping
386
- ? this.mapping[type](value, map)
387
- : (value === null || value === void 0 ? void 0 : value.toString()) || 'undefined';
388
- }
389
- }
390
-
391
- const types = new TypeMapper({
392
- date: (value) => value instanceof Date,
393
- regexp: (value) => value instanceof RegExp,
394
- array: (value) => Array.isArray(value),
395
- null: (value) => value === null,
396
- });
397
- new ValueMapper(types, {
398
- string: (value) => value ? `"${value}"` : 'EmptyString',
399
- date: (value, map) => map(value.toISOString()),
400
- object: (value, map) => {
401
- const string = String(value);
402
- if (/^\[([a-z]+) \1\]$/i.test(string)) {
403
- const mapped = Object.keys(value)
404
- .map((key) => `${key}:${map(value[key])}`);
405
- return `{${mapped.join(',')}}`;
406
- }
407
- return string;
408
- },
409
- array: (value, map) => `[${value.map(map).join(',')}]`,
410
- null: () => 'NULL',
411
- undefined: () => 'Undefined',
412
- function: (value) => {
413
- const { constructor: { name: cname }, name } = value;
414
- const [, async, generator, func] = cname.match(/^(async)?(generator)?(function)$/i);
415
- const [, stype, sname] = value.toString().match(/^(?:async)?(?:[\s\*]+)?(class|function)?(?:[\s\*]+)?([a-z_]\w*)?\s*[\(\{]?/i);
416
- const parts = []
417
- .concat(stype && !(name || sname) ? 'anonymous' : [])
418
- .concat(name && !stype && sname ? 'shorthand' : [])
419
- .concat(async || [], generator || [])
420
- .concat(!(stype || sname) ? 'arrow' : [])
421
- .concat(stype || func)
422
- .map((key) => key[0].toUpperCase() + key.slice(1));
423
- return [parts.join('')].concat(name || []).join(' ');
424
- },
425
- });
426
-
427
- /**
428
- * Create a guard verifying the given value matches the specified type
429
- */
430
- function is(type) {
431
- return (value) => typeof value === type;
432
- }
433
- /**
434
- * Create a guard verifying the given value matches any of the validators
435
- */
436
- function any(...checks) {
437
- return (value) => checks.some((check) => check(value));
438
- }
439
- /**
440
- * Create a guard verifying the given value matches all of the validators
441
- */
442
- function all(...checks) {
443
- return (value) => checks.every((check) => check(value));
444
- }
445
- /**
446
- * Create a guard verifying the given value matches none of the validators
447
- */
448
- function not(...checks) {
449
- return (value) => checks.every((check) => !check(value));
450
- }
451
-
452
- /**
453
- * Guard verifying the value is a array
454
- */
455
- const isArray = (value) => Array.isArray(value);
456
- /**
457
- * Guard verifying the value is a null
458
- */
459
- const isNULL = (value) => value === null;
460
- /**
461
- * Guard verifying the value is a number
462
- */
463
- const isNumber = is('number');
464
- /**
465
- * Guard verifying the value is a object
466
- */
467
- const isObject = all(not(isArray), not(isNULL), is('object'));
468
- /**
469
- * Guard verifying the value is a string
470
- */
471
- const isString = is('string');
472
-
473
- /**
474
- * Guard verifying the value to be an array containing only elements matching the validators
475
- */
476
- function isArrayOfType(...validators) {
477
- const check = all(...validators);
478
- return all(isArray, (value) => value.every(check));
479
- }
480
- /**
481
- * Guard verifying the value to be an array with a length between the given boundaries
482
- */
483
- function isArrayOfSize(min, max = Infinity) {
484
- return all(isArray, (value) => value.length >= min && value.length <= max);
485
- }
486
-
487
- /**
488
- * Creates a guard verifying the value is an object and has the given key
489
- */
490
- function isKey(key) {
491
- return all(isObject, (value) => key in value);
492
- }
493
- /**
494
- * Creates a guard verifying the value is an object and has the given key matching the validators
495
- */
496
- function isKeyOfType(key, ...validators) {
497
- return all(isKey(key), (value) => validators.every((check) => check(value[key])));
498
- }
499
- /**
500
- * Creates a guard verifying the value is an object and doesn't have the key or has the given key matching the validators
501
- */
502
- function isOptionalKeyOfType(key, ...validators) {
503
- return any(all(isObject, not(isKey(key))), isKeyOfType(key, ...validators));
504
- }
505
- /**
506
- * Creates a guard verifying the value is an object matching at least the structure
507
- */
508
- function isStructure(struct, ...options) {
509
- const optional = options.reduce((carry, key) => carry.concat(key), []);
510
- const validators = Object.keys(struct)
511
- .map((key) => (optional.includes(key) ? isOptionalKeyOfType : isKeyOfType)(key, struct[key]));
512
- return all(isObject, ...validators);
513
- }
514
-
515
- function isTuple(...rules) {
516
- return (value) => isArray(value) && value.length === rules.length && rules.every((rule, index) => rule(value[index]));
517
- }
518
-
519
- function isNumberValue(value) {
520
- return isNumber(value) && Number.isFinite(value);
521
- }
522
- function isNumberBetween(a, b = Infinity) {
523
- const min = Math.min(a, b);
524
- const max = Math.max(a, b);
525
- return (value) => isNumberValue(value) && value >= min && value <= max;
526
- }
527
-
528
- function isAltitude(value) {
529
- return isNumberValue(value);
530
- }
531
- const isStrictAltitude = isNumberBetween(-EARTH_RADIUS, GPS_SATELLITE_ORBIT);
532
-
533
- function isLatitude(value) {
534
- return isNumberValue(value);
535
- }
536
- const isStrictLatitude = isNumberBetween(-90, 90);
537
-
538
- function isLongitude(value) {
539
- return isNumberValue(value);
540
- }
541
- const isStrictLongitude = isNumberBetween(-180, 180);
542
-
543
- const isPosition = any(isTuple(isLongitude, isLatitude), isTuple(isLongitude, isLatitude, isAltitude));
544
- const isStrictPosition = any(isTuple(isStrictLongitude, isStrictLatitude), isTuple(isStrictLongitude, isStrictLatitude, isStrictAltitude));
545
-
546
- const isBoundingBoxWithAltitude = all(isTuple(isLongitude, isLatitude, isAltitude, isLongitude, isLatitude, isAltitude), ([, s, , , n]) => s <= n);
547
- const isBoundingBoxWithoutAltitude = all(isTuple(isLongitude, isLatitude, isLongitude, isLatitude), ([, s, , n]) => s <= n);
548
- const isBoundingBox = any(isBoundingBoxWithAltitude, isBoundingBoxWithoutAltitude);
549
-
550
- function isGeoJSONObject(type) {
551
- return isStructure({
552
- type: all(isString, (value) => value === type),
553
- bbox: isBoundingBox,
554
- }, 'bbox');
555
- }
556
-
557
- function isGeometryObject(type, isCoordinates) {
558
- return all(isGeoJSONObject(type), isKeyOfType('coordinates', isCoordinates));
559
- }
560
-
561
- const isPointCoordinates = isPosition;
562
- const isPoint = isGeometryObject('Point', isPointCoordinates);
563
- const isStrictPointCoordinates = isStrictPosition;
564
- const isStrictPoint = isGeometryObject('Point', isStrictPointCoordinates);
565
-
566
- const isMultiPointCoordinates = isArrayOfType(isPointCoordinates);
567
- const isMultiPoint = isGeometryObject('MultiPoint', isMultiPointCoordinates);
568
- const isStrictMultiPointCoordinates = isArrayOfType(isStrictPointCoordinates);
569
- const isStrictMultiPoint = isGeometryObject('MultiPoint', isStrictMultiPointCoordinates);
570
-
571
- const isLineStringCoordinates = isMultiPointCoordinates;
572
- const isLineString = isGeometryObject('LineString', isLineStringCoordinates);
573
- const isStrictLineStringCoordinates = isStrictMultiPointCoordinates;
574
- const isStrictLineString = isGeometryObject('LineString', isStrictLineStringCoordinates);
575
-
576
- const isMultiLineStringCoordinates = isArrayOfType(isLineStringCoordinates);
577
- const isMultiLineString = isGeometryObject('MultiLineString', isMultiLineStringCoordinates);
578
- const isStrictMultiLineStringCoordinates = isArrayOfType(isStrictLineStringCoordinates);
579
- const isStrictMultiLineString = isGeometryObject('MultiLineString', isStrictMultiLineStringCoordinates);
580
-
581
- isArrayOfType(isPosition);
582
-
583
- const isLinearRing = all(isArrayOfType(isPosition), isArrayOfSize(4), (value) => value[value.length - 1].every((v, i) => v === value[0][i]));
584
- const isStrictLinearRing = all(isArrayOfType(isStrictPosition), isArrayOfSize(4), (value) => value[value.length - 1].every((v, i) => v === value[0][i]));
585
-
586
- const isExteriorRing = all(isLinearRing);
587
-
588
- const isInteriorRing = all(isLinearRing);
589
-
590
- const isPolygonCoordinates = all(isArrayOfType(isLinearRing));
591
- const isPolygon = isGeometryObject('Polygon', isPolygonCoordinates);
592
- const isStrictPolygonCoordinates = all(isArrayOfType(isStrictLinearRing), (value) => isExteriorRing(value[0]), (value) => value.slice(1).every(isInteriorRing));
593
- const isStrictPolygon = isGeometryObject('Polygon', isStrictPolygonCoordinates);
594
-
595
- const isMultiPolygonCoordinates = isArrayOfType(isPolygonCoordinates);
596
- const isMultiPolygon = isGeometryObject('MultiPolygon', isMultiPolygonCoordinates);
597
- const isStrictMultiPolygonCoordinates = isArrayOfType(isStrictPolygonCoordinates);
598
- const isStrictMultiPolygon = isGeometryObject('MultiPolygon', isStrictMultiPolygonCoordinates);
599
-
600
- const isGeometry = any(isPoint, isMultiPoint, isLineString, isMultiLineString, isPolygon, isMultiPolygon);
601
- const isStrictGeometry = any(isStrictPoint, isStrictMultiPoint, isStrictLineString, isStrictMultiLineString, isStrictPolygon, isStrictMultiPolygon);
602
-
603
- const isGeometryCollectionObject = all(isGeoJSONObject('GeometryCollection'), isKeyOfType('geometries', isArrayOfType(any(isGeometry, isGeometryCollection))));
604
- const isStrictGeometryCollectionObject = all(isGeoJSONObject('GeometryCollection'), isKeyOfType('geometries', isArrayOfType(any(isStrictGeometry, isStrictGeometryCollection))));
605
- function isGeometryCollection(value) {
606
- return isGeometryCollectionObject(value);
607
- }
608
- function isStrictGeometryCollection(value) {
609
- return isStrictGeometryCollectionObject(value);
610
- }
611
-
612
- const isFeature = all(isGeoJSONObject('Feature'), isStructure({
613
- geometry: any(isGeometry, isGeometryCollection),
614
- properties: any(isNULL, isObject)
615
- }));
616
- const isStrictFeature = all(isGeoJSONObject('Feature'), isStructure({
617
- geometry: any(isStrictGeometry, isStrictGeometryCollection),
618
- properties: any(isNULL, isObject)
619
- }));
620
-
621
- const isFeatureCollection = all(isGeoJSONObject('FeatureCollection'), isKeyOfType('features', isArrayOfType(isFeature)));
622
- const isStrictFeatureCollection = all(isGeoJSONObject('FeatureCollection'), isKeyOfType('features', isArrayOfType(isStrictFeature)));
623
-
624
- const isGeoJSON = any(isGeometry, isGeometryCollection, isFeature, isFeatureCollection);
625
- const isStrictGeoJSON = any(isStrictGeometry, isStrictGeometryCollection, isStrictFeature, isStrictFeatureCollection);
626
-
627
- export { SimpleGeometryIterator, distance, intersect, isFeature, isFeatureCollection, isGeoJSON, isGeometry, isGeometryCollection, isLineString, isMultiLineString, isMultiPoint, isMultiPolygon, isPoint, isPolygon, isPosition, isStrictFeature, isStrictFeatureCollection, isStrictGeoJSON, isStrictGeometry, isStrictGeometryCollection, isStrictLineString, isStrictMultiLineString, isStrictMultiPoint, isStrictMultiPolygon, isStrictPoint, isStrictPolygon, isStrictPosition };
@@ -1 +0,0 @@
1
- function t(t){return t.slice(1).map(((n,e)=>[t[e],n]))}const n=6371008.7714,e=6356752.314245,o=Math.PI/180,i=Math.PI;function r(t){return t*t}function s(t){return t*o}const c=r(6378137),a=r(e),u=(c-a)/a,l=1/298.257223563,y={cartesian:([t,e],[o,i])=>n*s(Math.sqrt(r(o-t)+r(i-e))),haversine([t,e],[o,i]){const c=r(Math.sin(s(i-e)/2))+Math.cos(s(e))*Math.cos(s(i))*r(Math.sin(s(o-t)/2));return n*Math.atan2(Math.sqrt(c),Math.sqrt(1-c))*2},vincenty(...t){const[[n,o],[r,c]]=t.map((t=>t.map(s))),a=r-n,y=.9966471893352525*Math.tan(o),h=1/Math.sqrt(1+y*y),f=y*h,p=.9966471893352525*Math.tan(c),g=1/Math.sqrt(1+p*p),m=p*g,P=Math.abs(a)>i/2||Math.abs(c-o)>i/2;let d=a,M=null,S=null,L=P?i:0,b=0,w=P?-1:1,v=null,j=1,$=1,x=null,C=0;do{if(M=Math.sin(d),S=Math.cos(d),v=(g*M)**2+(h*m-f*g*S)**2,Math.abs(v)<1e-24)break;b=Math.sqrt(v),w=f*m+h*g*S,L=Math.atan2(b,w);const t=h*g*M/b;$=1-t*t,j=0!=$?w-2*f*m/$:0;const n=.00020955066654671753*$*(4+l*(4-3*$));x=d,d=a+(1-n)*l*t*(L+n*b*(j+n*w*(2*j*j-1)))}while(Math.abs(d-x)>1e-12&&++C<1e3);const F=$*u,q=F/1024*(256+F*(F*(74-47*F)-128));return e*(1+F/16384*(4096+F*(F*(320-175*F)-768)))*(L-q*b*(j+q/4*(w*(2*j*j-1)-q/6*j*(4*b*b-3)*(4*j*j-3))))}};function h(t,n){const[[e,o],[i,r],[s,c]]=[t,...n],[a,u]=[s-i,c-r],[l,y]=[e-i,o-r],h=(f=(l*a+y*u)/(a*a+u*u),p=0,g=1,Math.max(Math.min(f,g),p));var f,p,g;return 0===h||1===h?n[h]:[i+a*h,r+u*h]}function f(t,n,e){const o="function"==typeof e?e:y[e];if("function"==typeof o)return o(t,n);throw new Error(`Not a PointToPoint calculation function ${e}`)}function p(t,n,e){return f(t,h(t,n),e)}function g(t,n,e){return m(t,n)?0:Math.min(...t.map((t=>p(t,n,e))),...n.map((n=>p(n,t,e))))}function m(t,n){const[[e,o],[i,r]]=t,[[s,c],[a,u]]=n,[l,y,h,f]=[i-e,r-o,a-s,u-c],p=(-y*(e-s)+l*(o-c))/(-h*y+l*f),g=(h*(o-c)-f*(e-s))/(-h*y+l*f);return p>=0&&p<=1&&g>=0&&g<=1}function P(t,n,e=1e-14){return p(t,n,"cartesian")<e}function d(t,n){const{length:e}=n;return 0!==n.reduce(((o,i,r)=>{const s=n[(e+r-1)%e];return(i[1]<t[1]&&s[1]>=t[1]||s[1]<t[1]&&i[1]>=t[1])&&(i[0]<=t[0]||s[0]<=t[0])?o^Number(i[0]+(t[1]-i[1])/(s[1]-i[1])*(s[0]-i[0])<t[0]):o}),0)||n.slice(1).some(((e,o)=>P(t,[n[o],e])))}class M{constructor(...t){this.inputs=[],this.inputs=t}*[Symbol.iterator](){for(const t of this.inputs)for(const n of this.unwrap(t))yield n}*unwrap(t){t.type in this?yield*this[t.type](t):yield t}*GeometryCollection({geometries:t}){for(const n of t)yield*this.unwrap(n)}*FeatureCollection({features:t}){for(const{geometry:n}of t)yield*this.unwrap(n)}*Feature({geometry:t}){yield*this.unwrap(t)}*MultiPoint(t){for(const n of t.coordinates)yield{type:"Point",coordinates:n}}*MultiLineString(t){for(const n of t.coordinates)yield{type:"LineString",coordinates:n}}*MultiPolygon(t){for(const n of t.coordinates)yield{type:"Polygon",coordinates:n}}}class S{constructor(...t){this.iterators=[],this.iterators=t}*[Symbol.iterator](){for(const[t,n]of this.pairs(this.iterators))for(const e of t)for(const t of n)yield[e,t]}pairs(t){return t.map(((n,e)=>t.slice(e+1).map((t=>[n,t])))).flat()}}const L={PointPoint:(t,n)=>t.length>=2&&n.length>=2&&t.slice(0,2).every(((t,e)=>t===n[e])),LineStringPoint(n,e){return n.some((t=>this.PointPoint(t,e)))||t(n).some((t=>P(e,t)))},LineStringLineString(n,e){const o=t(e);return t(n).some((t=>o.some((n=>m(t,n)))))},PolygonPoint([t,...n],e){return(this.LineStringPoint(t,e)||d(e,t))&&(!n.length||n.every((t=>!d(e,t))))},PolygonLineString(t,n){return t.some((t=>this.LineStringLineString(t,n)))||n.some((n=>this.PolygonPoint(t,n)))},PolygonPolygon(t,n){return n.some((n=>this.PolygonLineString(t,n)||n.some((n=>this.PolygonPoint(t,n)))))||t.some((t=>this.PolygonLineString(n,t)||t.some((t=>this.PolygonPoint(n,t)))))}};function b(t,n){for(const[e,o]of new S(new M(t),new M(n)))if(e.type+o.type in L&&L[e.type+o.type](e.coordinates,o.coordinates)||o.type+e.type in L&&L[o.type+e.type](o.coordinates,e.coordinates))return!0;return!1}const w={PointPoint:(t,n,e)=>f(t,n,e),LineStringPoint:(n,e,o)=>Math.min(...t(n).map((t=>p(e,t,o)))),LineStringLineString(n,e,o){const i=t(n),r=t(e);return i.reduce(((t,n)=>r.reduce(((t,e)=>t>0?Math.min(t,g(n,e,o)):t),t)),1/0)},PolygonPoint([t,...n],e,o){if(d(e,t)){const[t]=n.filter((t=>d(e,t)));return t?this.LineStringPoint(t,e,o):0}return this.LineStringPoint(t,e,o)},PolygonLineString(n,e,o){const[i,...r]=n,s=t(e),c=e.some((t=>d(t,i)))?r.find((t=>e.every((n=>d(n,t))))):i;return c?Math.min(...t(c).map((t=>Math.min(...s.map((n=>g(t,n,o))))))):0},PolygonPolygon(t,n,e){return Math.min(this.PolygonLineString(t,n[0],e),this.PolygonLineString(n,t[0],e))}};function v(t,n,e="cartesian"){return Math.min(...[...new S(new M(t),new M(n))].map((([t,n])=>t.type+n.type in w?w[t.type+n.type](t.coordinates,n.coordinates,e):n.type+t.type in w?w[n.type+t.type](n.coordinates,t.coordinates,e):1/0)))}class j{constructor(t={}){this.mapping=Object.keys(t).map((n=>e=>t[n](e)?n:void 0)).concat((t=>typeof t))}map(t){return this.mapping.reduce(((n,e)=>n||e(t)),void 0)}}const $=new j({date:t=>t instanceof Date,regexp:t=>t instanceof RegExp,array:t=>Array.isArray(t),null:t=>null===t});function x(t){return n=>typeof n===t}function C(...t){return n=>t.some((t=>t(n)))}function F(...t){return n=>t.every((t=>t(n)))}function q(...t){return n=>t.every((t=>!t(n)))}new class{constructor(t=new j,n={}){this.types=t,this.mapping=n}map(t){const n=this.types.map(t);return n in this.mapping?this.mapping[n](t,(t=>this.map(t))):(null==t?void 0:t.toString())||"undefined"}}($,{string:t=>t?`"${t}"`:"EmptyString",date:(t,n)=>n(t.toISOString()),object:(t,n)=>{const e=String(t);if(/^\[([a-z]+) \1\]$/i.test(e)){return`{${Object.keys(t).map((e=>`${e}:${n(t[e])}`)).join(",")}}`}return e},array:(t,n)=>`[${t.map(n).join(",")}]`,null:()=>"NULL",undefined:()=>"Undefined",function:t=>{const{constructor:{name:n},name:e}=t,[,o,i,r]=n.match(/^(async)?(generator)?(function)$/i),[,s,c]=t.toString().match(/^(?:async)?(?:[\s\*]+)?(class|function)?(?:[\s\*]+)?([a-z_]\w*)?\s*[\(\{]?/i);return[[].concat(!s||e||c?[]:"anonymous").concat(e&&!s&&c?"shorthand":[]).concat(o||[],i||[]).concat(s||c?[]:"arrow").concat(s||r).map((t=>t[0].toUpperCase()+t.slice(1))).join("")].concat(e||[]).join(" ")}});const k=t=>Array.isArray(t),A=t=>null===t,N=x("number"),O=F(q(k),q(A),x("object")),E=x("string");function G(...t){const n=F(...t);return F(k,(t=>t.every(n)))}function I(t,n=1/0){return F(k,(e=>e.length>=t&&e.length<=n))}function U(t){return F(O,(n=>t in n))}function z(t,...n){return F(U(t),(e=>n.every((n=>n(e[t])))))}function D(t,...n){return C(F(O,q(U(t))),z(t,...n))}function R(t,...n){const e=n.reduce(((t,n)=>t.concat(n)),[]),o=Object.keys(t).map((n=>(e.includes(n)?D:z)(n,t[n])));return F(O,...o)}function T(...t){return n=>k(n)&&n.length===t.length&&t.every(((t,e)=>t(n[e])))}function _(t){return N(t)&&Number.isFinite(t)}function B(t,n=1/0){const e=Math.min(t,n),o=Math.max(t,n);return t=>_(t)&&t>=e&&t<=o}function H(t){return _(t)}const J=B(-6371008.7714,2018e4);function K(t){return _(t)}const Q=B(-90,90);function V(t){return _(t)}const W=B(-180,180),X=C(T(V,K),T(V,K,H)),Y=C(T(W,Q),T(W,Q,J)),Z=C(F(T(V,K,H,V,K,H),(([,t,,,n])=>t<=n)),F(T(V,K,V,K),(([,t,,n])=>t<=n)));function tt(t){return R({type:F(E,(n=>n===t)),bbox:Z},"bbox")}function nt(t,n){return F(tt(t),z("coordinates",n))}const et=X,ot=nt("Point",et),it=Y,rt=nt("Point",it),st=G(et),ct=nt("MultiPoint",st),at=G(it),ut=nt("MultiPoint",at),lt=st,yt=nt("LineString",lt),ht=at,ft=nt("LineString",ht),pt=nt("MultiLineString",G(lt)),gt=nt("MultiLineString",G(ht));G(X);const mt=F(G(X),I(4),(t=>t[t.length-1].every(((n,e)=>n===t[0][e])))),Pt=F(G(Y),I(4),(t=>t[t.length-1].every(((n,e)=>n===t[0][e])))),dt=F(mt),Mt=F(mt),St=F(G(mt)),Lt=nt("Polygon",St),bt=F(G(Pt),(t=>dt(t[0])),(t=>t.slice(1).every(Mt))),wt=nt("Polygon",bt),vt=nt("MultiPolygon",G(St)),jt=nt("MultiPolygon",G(bt)),$t=C(ot,ct,yt,pt,Lt,vt),xt=C(rt,ut,ft,gt,wt,jt),Ct=F(tt("GeometryCollection"),z("geometries",G(C($t,qt)))),Ft=F(tt("GeometryCollection"),z("geometries",G(C(xt,kt))));function qt(t){return Ct(t)}function kt(t){return Ft(t)}const At=F(tt("Feature"),R({geometry:C($t,qt),properties:C(A,O)})),Nt=F(tt("Feature"),R({geometry:C(xt,kt),properties:C(A,O)})),Ot=F(tt("FeatureCollection"),z("features",G(At))),Et=F(tt("FeatureCollection"),z("features",G(Nt))),Gt=C($t,qt,At,Ot),It=C(xt,kt,Nt,Et);export{M as SimpleGeometryIterator,v as distance,b as intersect,At as isFeature,Ot as isFeatureCollection,Gt as isGeoJSON,$t as isGeometry,qt as isGeometryCollection,yt as isLineString,pt as isMultiLineString,ct as isMultiPoint,vt as isMultiPolygon,ot as isPoint,Lt as isPolygon,X as isPosition,Nt as isStrictFeature,Et as isStrictFeatureCollection,It as isStrictGeoJSON,xt as isStrictGeometry,kt as isStrictGeometryCollection,ft as isStrictLineString,gt as isStrictMultiLineString,ut as isStrictMultiPoint,jt as isStrictMultiPolygon,rt as isStrictPoint,wt as isStrictPolygon,Y as isStrictPosition};