@turf/turf 7.0.0-alpha.0 → 7.0.0-alpha.1
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/package.json +113 -111
- package/turf.min.js +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/turf",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.1",
|
|
4
4
|
"description": "a JavaScript library for performing geospatial operations with GeoJSON",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,6 +48,7 @@
|
|
|
48
48
|
"exports": {
|
|
49
49
|
"./package.json": "./package.json",
|
|
50
50
|
".": {
|
|
51
|
+
"types": "./index.d.ts",
|
|
51
52
|
"import": "./dist/es/index.js",
|
|
52
53
|
"require": "./dist/js/index.js"
|
|
53
54
|
}
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
"scripts": {
|
|
64
65
|
"build": "rollup -c rollup.config.js && echo '{\"type\":\"module\"}' > dist/es/package.json",
|
|
65
66
|
"last-checks": "npm-run-all last-checks:testjs last-checks:example",
|
|
66
|
-
"last-checks:example": "
|
|
67
|
-
"last-checks:testjs": "
|
|
67
|
+
"last-checks:example": "tsx test.example.js",
|
|
68
|
+
"last-checks:testjs": "tsx test.js",
|
|
68
69
|
"test": "echo '@turf/turf tests run in the last-checks step'"
|
|
69
70
|
},
|
|
70
71
|
"devDependencies": {
|
|
@@ -78,115 +79,116 @@
|
|
|
78
79
|
"glob": "*",
|
|
79
80
|
"rollup": "^2.34.2",
|
|
80
81
|
"rollup-plugin-terser": "^7.0.2",
|
|
81
|
-
"tape": "*"
|
|
82
|
+
"tape": "*",
|
|
83
|
+
"tsx": "*"
|
|
82
84
|
},
|
|
83
85
|
"dependencies": {
|
|
84
|
-
"@turf/along": "^7.0.0-alpha.
|
|
85
|
-
"@turf/angle": "^7.0.0-alpha.
|
|
86
|
-
"@turf/area": "^7.0.0-alpha.
|
|
87
|
-
"@turf/bbox": "^7.0.0-alpha.
|
|
88
|
-
"@turf/bbox-clip": "^7.0.0-alpha.
|
|
89
|
-
"@turf/bbox-polygon": "^7.0.0-alpha.
|
|
90
|
-
"@turf/bearing": "^7.0.0-alpha.
|
|
91
|
-
"@turf/bezier-spline": "^7.0.0-alpha.
|
|
92
|
-
"@turf/boolean-clockwise": "^7.0.0-alpha.
|
|
93
|
-
"@turf/boolean-contains": "^7.0.0-alpha.
|
|
94
|
-
"@turf/boolean-crosses": "^7.0.0-alpha.
|
|
95
|
-
"@turf/boolean-disjoint": "^7.0.0-alpha.
|
|
96
|
-
"@turf/boolean-equal": "^7.0.0-alpha.
|
|
97
|
-
"@turf/boolean-intersects": "^7.0.0-alpha.
|
|
98
|
-
"@turf/boolean-overlap": "^7.0.0-alpha.
|
|
99
|
-
"@turf/boolean-parallel": "^7.0.0-alpha.
|
|
100
|
-
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.
|
|
101
|
-
"@turf/boolean-point-on-line": "^7.0.0-alpha.
|
|
102
|
-
"@turf/boolean-touches": "^7.0.0-alpha.
|
|
103
|
-
"@turf/boolean-within": "^7.0.0-alpha.
|
|
104
|
-
"@turf/buffer": "^7.0.0-alpha.
|
|
105
|
-
"@turf/center": "^7.0.0-alpha.
|
|
106
|
-
"@turf/center-mean": "^7.0.0-alpha.
|
|
107
|
-
"@turf/center-median": "^7.0.0-alpha.
|
|
108
|
-
"@turf/center-of-mass": "^7.0.0-alpha.
|
|
109
|
-
"@turf/centroid": "^7.0.0-alpha.
|
|
110
|
-
"@turf/circle": "^7.0.0-alpha.
|
|
111
|
-
"@turf/clean-coords": "^7.0.0-alpha.
|
|
112
|
-
"@turf/clone": "^7.0.0-alpha.
|
|
113
|
-
"@turf/clusters": "^7.0.0-alpha.
|
|
114
|
-
"@turf/clusters-dbscan": "^7.0.0-alpha.
|
|
115
|
-
"@turf/clusters-kmeans": "^7.0.0-alpha.
|
|
116
|
-
"@turf/collect": "^7.0.0-alpha.
|
|
117
|
-
"@turf/combine": "^7.0.0-alpha.
|
|
118
|
-
"@turf/concave": "^7.0.0-alpha.
|
|
119
|
-
"@turf/convex": "^7.0.0-alpha.
|
|
120
|
-
"@turf/destination": "^7.0.0-alpha.
|
|
121
|
-
"@turf/difference": "^7.0.0-alpha.
|
|
122
|
-
"@turf/dissolve": "^7.0.0-alpha.
|
|
123
|
-
"@turf/distance": "^7.0.0-alpha.
|
|
124
|
-
"@turf/distance-weight": "^7.0.0-alpha.
|
|
125
|
-
"@turf/ellipse": "^7.0.0-alpha.
|
|
126
|
-
"@turf/envelope": "^7.0.0-alpha.
|
|
127
|
-
"@turf/explode": "^7.0.0-alpha.
|
|
128
|
-
"@turf/flatten": "^7.0.0-alpha.
|
|
129
|
-
"@turf/flip": "^7.0.0-alpha.
|
|
130
|
-
"@turf/great-circle": "^7.0.0-alpha.
|
|
131
|
-
"@turf/helpers": "^7.0.0-alpha.
|
|
132
|
-
"@turf/hex-grid": "^7.0.0-alpha.
|
|
133
|
-
"@turf/interpolate": "^7.0.0-alpha.
|
|
134
|
-
"@turf/intersect": "^7.0.0-alpha.
|
|
135
|
-
"@turf/invariant": "^7.0.0-alpha.
|
|
136
|
-
"@turf/isobands": "^7.0.0-alpha.
|
|
137
|
-
"@turf/isolines": "^7.0.0-alpha.
|
|
138
|
-
"@turf/kinks": "^7.0.0-alpha.
|
|
139
|
-
"@turf/length": "^7.0.0-alpha.
|
|
140
|
-
"@turf/line-arc": "^7.0.0-alpha.
|
|
141
|
-
"@turf/line-chunk": "^7.0.0-alpha.
|
|
142
|
-
"@turf/line-intersect": "^7.0.0-alpha.
|
|
143
|
-
"@turf/line-offset": "^7.0.0-alpha.
|
|
144
|
-
"@turf/line-overlap": "^7.0.0-alpha.
|
|
145
|
-
"@turf/line-segment": "^7.0.0-alpha.
|
|
146
|
-
"@turf/line-slice": "^7.0.0-alpha.
|
|
147
|
-
"@turf/line-slice-along": "^7.0.0-alpha.
|
|
148
|
-
"@turf/line-split": "^7.0.0-alpha.
|
|
149
|
-
"@turf/line-to-polygon": "^7.0.0-alpha.
|
|
150
|
-
"@turf/mask": "^7.0.0-alpha.
|
|
151
|
-
"@turf/meta": "^7.0.0-alpha.
|
|
152
|
-
"@turf/midpoint": "^7.0.0-alpha.
|
|
153
|
-
"@turf/moran-index": "^7.0.0-alpha.
|
|
154
|
-
"@turf/nearest-point": "^7.0.0-alpha.
|
|
155
|
-
"@turf/nearest-point-on-line": "^7.0.0-alpha.
|
|
156
|
-
"@turf/nearest-point-to-line": "^7.0.0-alpha.
|
|
157
|
-
"@turf/planepoint": "^7.0.0-alpha.
|
|
158
|
-
"@turf/point-grid": "^7.0.0-alpha.
|
|
159
|
-
"@turf/point-on-feature": "^7.0.0-alpha.
|
|
160
|
-
"@turf/point-to-line-distance": "^7.0.0-alpha.
|
|
161
|
-
"@turf/points-within-polygon": "^7.0.0-alpha.
|
|
162
|
-
"@turf/polygon-smooth": "^7.0.0-alpha.
|
|
163
|
-
"@turf/polygon-tangents": "^7.0.0-alpha.
|
|
164
|
-
"@turf/polygon-to-line": "^7.0.0-alpha.
|
|
165
|
-
"@turf/polygonize": "^7.0.0-alpha.
|
|
166
|
-
"@turf/projection": "^7.0.0-alpha.
|
|
167
|
-
"@turf/random": "^7.0.0-alpha.
|
|
168
|
-
"@turf/rewind": "^7.0.0-alpha.
|
|
169
|
-
"@turf/rhumb-bearing": "^7.0.0-alpha.
|
|
170
|
-
"@turf/rhumb-destination": "^7.0.0-alpha.
|
|
171
|
-
"@turf/rhumb-distance": "^7.0.0-alpha.
|
|
172
|
-
"@turf/sample": "^7.0.0-alpha.
|
|
173
|
-
"@turf/sector": "^7.0.0-alpha.
|
|
174
|
-
"@turf/shortest-path": "^7.0.0-alpha.
|
|
175
|
-
"@turf/simplify": "^7.0.0-alpha.
|
|
176
|
-
"@turf/square": "^7.0.0-alpha.
|
|
177
|
-
"@turf/square-grid": "^7.0.0-alpha.
|
|
178
|
-
"@turf/standard-deviational-ellipse": "^7.0.0-alpha.
|
|
179
|
-
"@turf/tag": "^7.0.0-alpha.
|
|
180
|
-
"@turf/tesselate": "^7.0.0-alpha.
|
|
181
|
-
"@turf/tin": "^7.0.0-alpha.
|
|
182
|
-
"@turf/transform-rotate": "^7.0.0-alpha.
|
|
183
|
-
"@turf/transform-scale": "^7.0.0-alpha.
|
|
184
|
-
"@turf/transform-translate": "^7.0.0-alpha.
|
|
185
|
-
"@turf/triangle-grid": "^7.0.0-alpha.
|
|
186
|
-
"@turf/truncate": "^7.0.0-alpha.
|
|
187
|
-
"@turf/union": "^7.0.0-alpha.
|
|
188
|
-
"@turf/unkink-polygon": "^7.0.0-alpha.
|
|
189
|
-
"@turf/voronoi": "^7.0.0-alpha.
|
|
86
|
+
"@turf/along": "^7.0.0-alpha.1",
|
|
87
|
+
"@turf/angle": "^7.0.0-alpha.1",
|
|
88
|
+
"@turf/area": "^7.0.0-alpha.1",
|
|
89
|
+
"@turf/bbox": "^7.0.0-alpha.1",
|
|
90
|
+
"@turf/bbox-clip": "^7.0.0-alpha.1",
|
|
91
|
+
"@turf/bbox-polygon": "^7.0.0-alpha.1",
|
|
92
|
+
"@turf/bearing": "^7.0.0-alpha.1",
|
|
93
|
+
"@turf/bezier-spline": "^7.0.0-alpha.1",
|
|
94
|
+
"@turf/boolean-clockwise": "^7.0.0-alpha.1",
|
|
95
|
+
"@turf/boolean-contains": "^7.0.0-alpha.1",
|
|
96
|
+
"@turf/boolean-crosses": "^7.0.0-alpha.1",
|
|
97
|
+
"@turf/boolean-disjoint": "^7.0.0-alpha.1",
|
|
98
|
+
"@turf/boolean-equal": "^7.0.0-alpha.1",
|
|
99
|
+
"@turf/boolean-intersects": "^7.0.0-alpha.1",
|
|
100
|
+
"@turf/boolean-overlap": "^7.0.0-alpha.1",
|
|
101
|
+
"@turf/boolean-parallel": "^7.0.0-alpha.1",
|
|
102
|
+
"@turf/boolean-point-in-polygon": "^7.0.0-alpha.1",
|
|
103
|
+
"@turf/boolean-point-on-line": "^7.0.0-alpha.1",
|
|
104
|
+
"@turf/boolean-touches": "^7.0.0-alpha.1",
|
|
105
|
+
"@turf/boolean-within": "^7.0.0-alpha.1",
|
|
106
|
+
"@turf/buffer": "^7.0.0-alpha.1",
|
|
107
|
+
"@turf/center": "^7.0.0-alpha.1",
|
|
108
|
+
"@turf/center-mean": "^7.0.0-alpha.1",
|
|
109
|
+
"@turf/center-median": "^7.0.0-alpha.1",
|
|
110
|
+
"@turf/center-of-mass": "^7.0.0-alpha.1",
|
|
111
|
+
"@turf/centroid": "^7.0.0-alpha.1",
|
|
112
|
+
"@turf/circle": "^7.0.0-alpha.1",
|
|
113
|
+
"@turf/clean-coords": "^7.0.0-alpha.1",
|
|
114
|
+
"@turf/clone": "^7.0.0-alpha.1",
|
|
115
|
+
"@turf/clusters": "^7.0.0-alpha.1",
|
|
116
|
+
"@turf/clusters-dbscan": "^7.0.0-alpha.1",
|
|
117
|
+
"@turf/clusters-kmeans": "^7.0.0-alpha.1",
|
|
118
|
+
"@turf/collect": "^7.0.0-alpha.1",
|
|
119
|
+
"@turf/combine": "^7.0.0-alpha.1",
|
|
120
|
+
"@turf/concave": "^7.0.0-alpha.1",
|
|
121
|
+
"@turf/convex": "^7.0.0-alpha.1",
|
|
122
|
+
"@turf/destination": "^7.0.0-alpha.1",
|
|
123
|
+
"@turf/difference": "^7.0.0-alpha.1",
|
|
124
|
+
"@turf/dissolve": "^7.0.0-alpha.1",
|
|
125
|
+
"@turf/distance": "^7.0.0-alpha.1",
|
|
126
|
+
"@turf/distance-weight": "^7.0.0-alpha.1",
|
|
127
|
+
"@turf/ellipse": "^7.0.0-alpha.1",
|
|
128
|
+
"@turf/envelope": "^7.0.0-alpha.1",
|
|
129
|
+
"@turf/explode": "^7.0.0-alpha.1",
|
|
130
|
+
"@turf/flatten": "^7.0.0-alpha.1",
|
|
131
|
+
"@turf/flip": "^7.0.0-alpha.1",
|
|
132
|
+
"@turf/great-circle": "^7.0.0-alpha.1",
|
|
133
|
+
"@turf/helpers": "^7.0.0-alpha.1",
|
|
134
|
+
"@turf/hex-grid": "^7.0.0-alpha.1",
|
|
135
|
+
"@turf/interpolate": "^7.0.0-alpha.1",
|
|
136
|
+
"@turf/intersect": "^7.0.0-alpha.1",
|
|
137
|
+
"@turf/invariant": "^7.0.0-alpha.1",
|
|
138
|
+
"@turf/isobands": "^7.0.0-alpha.1",
|
|
139
|
+
"@turf/isolines": "^7.0.0-alpha.1",
|
|
140
|
+
"@turf/kinks": "^7.0.0-alpha.1",
|
|
141
|
+
"@turf/length": "^7.0.0-alpha.1",
|
|
142
|
+
"@turf/line-arc": "^7.0.0-alpha.1",
|
|
143
|
+
"@turf/line-chunk": "^7.0.0-alpha.1",
|
|
144
|
+
"@turf/line-intersect": "^7.0.0-alpha.1",
|
|
145
|
+
"@turf/line-offset": "^7.0.0-alpha.1",
|
|
146
|
+
"@turf/line-overlap": "^7.0.0-alpha.1",
|
|
147
|
+
"@turf/line-segment": "^7.0.0-alpha.1",
|
|
148
|
+
"@turf/line-slice": "^7.0.0-alpha.1",
|
|
149
|
+
"@turf/line-slice-along": "^7.0.0-alpha.1",
|
|
150
|
+
"@turf/line-split": "^7.0.0-alpha.1",
|
|
151
|
+
"@turf/line-to-polygon": "^7.0.0-alpha.1",
|
|
152
|
+
"@turf/mask": "^7.0.0-alpha.1",
|
|
153
|
+
"@turf/meta": "^7.0.0-alpha.1",
|
|
154
|
+
"@turf/midpoint": "^7.0.0-alpha.1",
|
|
155
|
+
"@turf/moran-index": "^7.0.0-alpha.1",
|
|
156
|
+
"@turf/nearest-point": "^7.0.0-alpha.1",
|
|
157
|
+
"@turf/nearest-point-on-line": "^7.0.0-alpha.1",
|
|
158
|
+
"@turf/nearest-point-to-line": "^7.0.0-alpha.1",
|
|
159
|
+
"@turf/planepoint": "^7.0.0-alpha.1",
|
|
160
|
+
"@turf/point-grid": "^7.0.0-alpha.1",
|
|
161
|
+
"@turf/point-on-feature": "^7.0.0-alpha.1",
|
|
162
|
+
"@turf/point-to-line-distance": "^7.0.0-alpha.1",
|
|
163
|
+
"@turf/points-within-polygon": "^7.0.0-alpha.1",
|
|
164
|
+
"@turf/polygon-smooth": "^7.0.0-alpha.1",
|
|
165
|
+
"@turf/polygon-tangents": "^7.0.0-alpha.1",
|
|
166
|
+
"@turf/polygon-to-line": "^7.0.0-alpha.1",
|
|
167
|
+
"@turf/polygonize": "^7.0.0-alpha.1",
|
|
168
|
+
"@turf/projection": "^7.0.0-alpha.1",
|
|
169
|
+
"@turf/random": "^7.0.0-alpha.1",
|
|
170
|
+
"@turf/rewind": "^7.0.0-alpha.1",
|
|
171
|
+
"@turf/rhumb-bearing": "^7.0.0-alpha.1",
|
|
172
|
+
"@turf/rhumb-destination": "^7.0.0-alpha.1",
|
|
173
|
+
"@turf/rhumb-distance": "^7.0.0-alpha.1",
|
|
174
|
+
"@turf/sample": "^7.0.0-alpha.1",
|
|
175
|
+
"@turf/sector": "^7.0.0-alpha.1",
|
|
176
|
+
"@turf/shortest-path": "^7.0.0-alpha.1",
|
|
177
|
+
"@turf/simplify": "^7.0.0-alpha.1",
|
|
178
|
+
"@turf/square": "^7.0.0-alpha.1",
|
|
179
|
+
"@turf/square-grid": "^7.0.0-alpha.1",
|
|
180
|
+
"@turf/standard-deviational-ellipse": "^7.0.0-alpha.1",
|
|
181
|
+
"@turf/tag": "^7.0.0-alpha.1",
|
|
182
|
+
"@turf/tesselate": "^7.0.0-alpha.1",
|
|
183
|
+
"@turf/tin": "^7.0.0-alpha.1",
|
|
184
|
+
"@turf/transform-rotate": "^7.0.0-alpha.1",
|
|
185
|
+
"@turf/transform-scale": "^7.0.0-alpha.1",
|
|
186
|
+
"@turf/transform-translate": "^7.0.0-alpha.1",
|
|
187
|
+
"@turf/triangle-grid": "^7.0.0-alpha.1",
|
|
188
|
+
"@turf/truncate": "^7.0.0-alpha.1",
|
|
189
|
+
"@turf/union": "^7.0.0-alpha.1",
|
|
190
|
+
"@turf/unkink-polygon": "^7.0.0-alpha.1",
|
|
191
|
+
"@turf/voronoi": "^7.0.0-alpha.1"
|
|
190
192
|
},
|
|
191
|
-
"gitHead": "
|
|
193
|
+
"gitHead": "cf7a0c507b017ca066acffd0ce23bda5b393fb5a"
|
|
192
194
|
}
|
package/turf.min.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(t,e)||u(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||u(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=u(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var c=6371008.8,f={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*c,kilometers:6371.0088,kilometres:6371.0088,meters:c,metres:c,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:c/1852,radians:1,yards:6967335.223679999},g={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function p(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function v(t,e){switch(t){case"Point":return d(e).geometry;case"LineString":return x(e).geometry;case"Polygon":return m(e).geometry;case"MultiPoint":return b(e).geometry;case"MultiLineString":return w(e).geometry;case"MultiPolygon":return I(e).geometry;default:throw new Error(t+" is invalid")}}function d(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!D(t[0])||!D(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return p(r,e,n)}function y(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return d(t,e)})),n)}function m(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=h(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}}catch(t){i.e(t)}finally{i.f()}var a={type:"Polygon",coordinates:t};return p(a,e,r)}function _(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return m(t,e)})),n)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:t};return p(r,e,n)}function E(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return x(t,e)})),n)}function k(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function w(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiLineString",coordinates:t};return p(r,e,n)}function b(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiPoint",coordinates:t};return p(r,e,n)}function I(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiPolygon",coordinates:t};return p(r,e,n)}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"GeometryCollection",geometries:t};return p(r,e,n)}function N(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=f[e];if(!n)throw new Error(e+" units is invalid");return t*n}function P(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=f[e];if(!n)throw new Error(e+" units is invalid");return t/n}function L(t,e){return R(P(t,e))}function C(t){var e=t%360;return e<0&&(e+=360),e}function R(t){return 180*(t%(2*Math.PI))/Math.PI}function T(t){return t%360*Math.PI/180}function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("length must be a positive number");return M(P(t,e),n)}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"meters",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("area must be a positive number");var r=g[e];if(!r)throw new Error("invalid original units");var i=g[n];if(!i)throw new Error("invalid final units");return t/r*i}function D(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function F(t){return null!==t&&"object"===e(t)&&!Array.isArray(t)}function q(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!D(t))throw new Error("bbox must only contain numbers")}))}function G(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(e(t)))throw new Error("id must be a number or a string")}var Y=Object.freeze({__proto__:null,earthRadius:c,factors:f,areaFactors:g,feature:p,geometry:v,point:d,points:y,polygon:m,polygons:_,lineString:x,lineStrings:E,featureCollection:k,multiLineString:w,multiPoint:b,multiPolygon:I,geometryCollection:S,round:N,radiansToLength:M,lengthToRadians:P,lengthToDegrees:L,bearingToAzimuth:C,radiansToDegrees:R,degreesToRadians:T,convertLength:O,convertArea:A,isNumber:D,isObject:F,validateBBox:q,validateId:G});function B(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,h,c=0,f=0,g=t.type,p="FeatureCollection"===g,v="Feature"===g,d=p?t.features.length:1,y=0;y<d;y++){a=(h=!!(l=p?t.features[y].geometry:v?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var _=0,x=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var E=s.type;switch(c=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,f,y,_,x))return!1;f++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],f,y,_,x))return!1;f++,"MultiPoint"===E&&_++}"LineString"===E&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(!1===e(u[r][i],f,y,_,x))return!1;f++}"MultiLineString"===E&&_++,"Polygon"===E&&x++}"Polygon"===E&&_++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(x=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(!1===e(u[r][i][o],f,y,_,x))return!1;f++}x++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===B(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function z(t,e,n,r){var i=n;return B(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function X(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function j(t,e,n){var r=n;return X(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function U(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function V(t,e,n){var r=n;return U(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function Z(t){var e=[];return B(t,(function(t){e.push(t)})),e}function H(t,e){var n,r,i,o,s,a,u,l,h,c,f=0,g="FeatureCollection"===t.type,p="Feature"===t.type,v=g?t.features.length:1;for(n=0;n<v;n++){for(a=g?t.features[n].geometry:p?t.geometry:t,l=g?t.features[n].properties:p?t.properties:{},h=g?t.features[n].bbox:p?t.bbox:void 0,c=g?t.features[n].id:p?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function W(t,e,n){var r=n;return H(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function J(t,e){H(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(p(t,r,{bbox:i,id:o}),n,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(p({type:s,coordinates:l},r),n,u))return!1}}))}function Q(t,e,n){var r=n;return J(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function K(t,e){J(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==B(t,(function(o,h,c,f,g){if(void 0===s||n>a||f>u||g>l)return s=o,a=n,u=f,l=g,void(i=0);var p=x([s,o],t.properties);if(!1===e(p,n,r,g,i))return!1;i++,s=o}))&&void 0}}}))}function $(t,e,n){var r=n,i=!1;return K(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function tt(t,e){if(!t)throw new Error("geojson is required");J(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(x(o[s],t.properties),n,r,s))return!1}}}))}function et(t,e,n){var r=n;return tt(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function nt(t,e){if(!F(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),x([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),x([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),x([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),x([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function rt(t,e){if(!F(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return d(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),d(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),d(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),d(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),d(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),d(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var it=Object.freeze({__proto__:null,coordAll:Z,coordEach:B,coordReduce:z,featureEach:U,featureReduce:V,findPoint:rt,findSegment:nt,flattenEach:J,flattenReduce:Q,geomEach:H,geomReduce:W,lineEach:tt,lineReduce:et,propEach:X,propReduce:j,segmentEach:K,segmentReduce:$});function ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t.bbox&&!0!==e.recompute)return t.bbox;var n=[1/0,1/0,-1/0,-1/0];return B(t,(function(t){n[0]>t[0]&&(n[0]=t[0]),n[1]>t[1]&&(n[1]=t[1]),n[2]<t[0]&&(n[2]=t[0]),n[3]<t[1]&&(n[3]=t[1])})),n}function st(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return a(t.geometry.coordinates);if("Point"===t.type)return a(t.coordinates)}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return a(t);throw new Error("coord must be GeoJSON Point or an Array of numbers")}function at(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ut(t){if(t.length>1&&D(t[0])&&D(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return ut(t[0]);throw new Error("coordinates must only contain numbers")}function lt(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function ht(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function ct(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");var r,i=h(t.features);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}catch(t){i.e(t)}finally{i.f()}}function ft(t){return"Feature"===t.type?t.geometry:t}function gt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}ot.default=ot;var pt=Object.freeze({__proto__:null,getCoord:st,getCoords:at,containsNumber:ut,geojsonType:lt,featureOf:ht,collectionOf:ct,getGeom:ft,getType:gt}),vt={successCallback:null,verbose:!1},dt={};
|
|
1
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).turf={})}(this,(function(t){"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function i(t,e,n){return e&&r(t.prototype,e),n&&r(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function o(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null==n)return;var r,i,o=[],s=!0,a=!1;try{for(n=n.call(t);!(s=(r=n.next()).done)&&(o.push(r.value),!e||o.length!==e);s=!0);}catch(t){a=!0,i=t}finally{try{s||null==n.return||n.return()}finally{if(a)throw i}}return o}(t,e)||u(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function a(t){return function(t){if(Array.isArray(t))return l(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||u(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function u(t,e){if(t){if("string"==typeof t)return l(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(t,e):void 0}}function l(t,e){(null==e||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function h(t,e){var n="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!n){if(Array.isArray(t)||(n=u(t))||e&&t&&"number"==typeof t.length){n&&(t=n);var r=0,i=function(){};return{s:i,n:function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=n.call(t)},n:function(){var t=n.next();return s=t.done,t},e:function(t){a=!0,o=t},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}var c=6371008.8,f={centimeters:637100880,centimetres:637100880,degrees:360/(2*Math.PI),feet:20902260.511392,inches:39.37*c,kilometers:6371.0088,kilometres:6371.0088,meters:c,metres:c,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:c/1852,radians:1,yards:6967335.223679999},g={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:2.9155334959812285e-7,millimeters:1e6,millimetres:1e6,yards:1.195990046};function p(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"Feature"};return(0===n.id||n.id)&&(r.id=n.id),n.bbox&&(r.bbox=n.bbox),r.properties=e||{},r.geometry=t,r}function v(t,e){switch(t){case"Point":return d(e).geometry;case"LineString":return x(e).geometry;case"Polygon":return m(e).geometry;case"MultiPoint":return b(e).geometry;case"MultiLineString":return w(e).geometry;case"MultiPolygon":return I(e).geometry;default:throw new Error(t+" is invalid")}}function d(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!D(t[0])||!D(t[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:t};return p(r,e,n)}function y(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return d(t,e)})),n)}function m(t,e){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=h(t);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}}catch(t){i.e(t)}finally{i.f()}var a={type:"Polygon",coordinates:t};return p(a,e,r)}function _(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return m(t,e)})),n)}function x(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(t.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:t};return p(r,e,n)}function E(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return k(t.map((function(t){return x(t,e)})),n)}function k(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=t,n}function w(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiLineString",coordinates:t};return p(r,e,n)}function b(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiPoint",coordinates:t};return p(r,e,n)}function I(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"MultiPolygon",coordinates:t};return p(r,e,n)}function S(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r={type:"GeometryCollection",geometries:t};return p(r,e,n)}function N(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;if(e&&!(e>=0))throw new Error("precision must be a positive number");var n=Math.pow(10,e||0);return Math.round(t*n)/n}function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=f[e];if(!n)throw new Error(e+" units is invalid");return t*n}function P(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=f[e];if(!n)throw new Error(e+" units is invalid");return t/n}function L(t,e){return R(P(t,e))}function C(t){var e=t%360;return e<0&&(e+=360),e}function R(t){return 180*(t%(2*Math.PI))/Math.PI}function T(t){return t%360*Math.PI/180}function O(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"kilometers",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("length must be a positive number");return M(P(t,e),n)}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"meters",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"kilometers";if(!(t>=0))throw new Error("area must be a positive number");var r=g[e];if(!r)throw new Error("invalid original units");var i=g[n];if(!i)throw new Error("invalid final units");return t/r*i}function D(t){return!isNaN(t)&&null!==t&&!Array.isArray(t)}function F(t){return null!==t&&"object"===e(t)&&!Array.isArray(t)}function q(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(4!==t.length&&6!==t.length)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach((function(t){if(!D(t))throw new Error("bbox must only contain numbers")}))}function G(t){if(!t)throw new Error("id is required");if(-1===["string","number"].indexOf(e(t)))throw new Error("id must be a number or a string")}var Y=Object.freeze({__proto__:null,earthRadius:c,factors:f,areaFactors:g,feature:p,geometry:v,point:d,points:y,polygon:m,polygons:_,lineString:x,lineStrings:E,featureCollection:k,multiLineString:w,multiPoint:b,multiPolygon:I,geometryCollection:S,round:N,radiansToLength:M,lengthToRadians:P,lengthToDegrees:L,bearingToAzimuth:C,radiansToDegrees:R,degreesToRadians:T,convertLength:O,convertArea:A,isNumber:D,isObject:F,validateBBox:q,validateId:G});function B(t,e,n){if(null!==t)for(var r,i,o,s,a,u,l,h,c=0,f=0,g=t.type,p="FeatureCollection"===g,v="Feature"===g,d=p?t.features.length:1,y=0;y<d;y++){a=(h=!!(l=p?t.features[y].geometry:v?t.geometry:t)&&"GeometryCollection"===l.type)?l.geometries.length:1;for(var m=0;m<a;m++){var _=0,x=0;if(null!==(s=h?l.geometries[m]:l)){u=s.coordinates;var E=s.type;switch(c=!n||"Polygon"!==E&&"MultiPolygon"!==E?0:1,E){case null:break;case"Point":if(!1===e(u,f,y,_,x))return!1;f++,_++;break;case"LineString":case"MultiPoint":for(r=0;r<u.length;r++){if(!1===e(u[r],f,y,_,x))return!1;f++,"MultiPoint"===E&&_++}"LineString"===E&&_++;break;case"Polygon":case"MultiLineString":for(r=0;r<u.length;r++){for(i=0;i<u[r].length-c;i++){if(!1===e(u[r][i],f,y,_,x))return!1;f++}"MultiLineString"===E&&_++,"Polygon"===E&&x++}"Polygon"===E&&_++;break;case"MultiPolygon":for(r=0;r<u.length;r++){for(x=0,i=0;i<u[r].length;i++){for(o=0;o<u[r][i].length-c;o++){if(!1===e(u[r][i][o],f,y,_,x))return!1;f++}x++}_++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(!1===B(s.geometries[r],e,n))return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function z(t,e,n,r){var i=n;return B(t,(function(t,r,o,s,a){i=0===r&&void 0===n?t:e(i,t,r,o,s,a)}),r),i}function X(t,e){var n;switch(t.type){case"FeatureCollection":for(n=0;n<t.features.length&&!1!==e(t.features[n].properties,n);n++);break;case"Feature":e(t.properties,0)}}function j(t,e,n){var r=n;return X(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function U(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var n=0;n<t.features.length&&!1!==e(t.features[n],n);n++);}function V(t,e,n){var r=n;return U(t,(function(t,i){r=0===i&&void 0===n?t:e(r,t,i)})),r}function Z(t){var e=[];return B(t,(function(t){e.push(t)})),e}function H(t,e){var n,r,i,o,s,a,u,l,h,c,f=0,g="FeatureCollection"===t.type,p="Feature"===t.type,v=g?t.features.length:1;for(n=0;n<v;n++){for(a=g?t.features[n].geometry:p?t.geometry:t,l=g?t.features[n].properties:p?t.properties:{},h=g?t.features[n].bbox:p?t.bbox:void 0,c=g?t.features[n].id:p?t.id:void 0,s=(u=!!a&&"GeometryCollection"===a.type)?a.geometries.length:1,i=0;i<s;i++)if(null!==(o=u?a.geometries[i]:a))switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":if(!1===e(o,f,l,h,c))return!1;break;case"GeometryCollection":for(r=0;r<o.geometries.length;r++)if(!1===e(o.geometries[r],f,l,h,c))return!1;break;default:throw new Error("Unknown Geometry Type")}else if(!1===e(null,f,l,h,c))return!1;f++}}function W(t,e,n){var r=n;return H(t,(function(t,i,o,s,a){r=0===i&&void 0===n?t:e(r,t,i,o,s,a)})),r}function J(t,e){H(t,(function(t,n,r,i,o){var s,a=null===t?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return!1!==e(p(t,r,{bbox:i,id:o}),n,0)&&void 0}switch(a){case"MultiPoint":s="Point";break;case"MultiLineString":s="LineString";break;case"MultiPolygon":s="Polygon"}for(var u=0;u<t.coordinates.length;u++){var l=t.coordinates[u];if(!1===e(p({type:s,coordinates:l},r),n,u))return!1}}))}function Q(t,e,n){var r=n;return J(t,(function(t,i,o){r=0===i&&0===o&&void 0===n?t:e(r,t,i,o)})),r}function K(t,e){J(t,(function(t,n,r){var i=0;if(t.geometry){var o=t.geometry.type;if("Point"!==o&&"MultiPoint"!==o){var s,a=0,u=0,l=0;return!1!==B(t,(function(o,h,c,f,g){if(void 0===s||n>a||f>u||g>l)return s=o,a=n,u=f,l=g,void(i=0);var p=x([s,o],t.properties);if(!1===e(p,n,r,g,i))return!1;i++,s=o}))&&void 0}}}))}function $(t,e,n){var r=n,i=!1;return K(t,(function(t,o,s,a,u){r=!1===i&&void 0===n?t:e(r,t,o,s,a,u),i=!0})),r}function tt(t,e){if(!t)throw new Error("geojson is required");J(t,(function(t,n,r){if(null!==t.geometry){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(!1===e(t,n,r,0,0))return!1;break;case"Polygon":for(var s=0;s<o.length;s++)if(!1===e(x(o[s],t.properties),n,r,s))return!1}}}))}function et(t,e,n){var r=n;return tt(t,(function(t,i,o,s){r=0===i&&void 0===n?t:e(r,t,i,o,s)})),r}function nt(t,e){if(!F(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.segmentIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":case"MultiPoint":return null;case"LineString":return s<0&&(s=u.length+s-1),x([u[s],u[s+1]],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s-1),x([u[o][s],u[o][s+1]],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s-1),x([u[i][s],u[i][s+1]],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s-1),x([u[i][o][s],u[i][o][s+1]],a,e)}throw new Error("geojson is invalid")}function rt(t,e){if(!F(e=e||{}))throw new Error("options is invalid");var n,r=e.featureIndex||0,i=e.multiFeatureIndex||0,o=e.geometryIndex||0,s=e.coordIndex||0,a=e.properties;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),a=a||t.features[r].properties,n=t.features[r].geometry;break;case"Feature":a=a||t.properties,n=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":n=t;break;default:throw new Error("geojson is invalid")}if(null===n)return null;var u=n.coordinates;switch(n.type){case"Point":return d(u,a,e);case"MultiPoint":return i<0&&(i=u.length+i),d(u[i],a,e);case"LineString":return s<0&&(s=u.length+s),d(u[s],a,e);case"Polygon":return o<0&&(o=u.length+o),s<0&&(s=u[o].length+s),d(u[o][s],a,e);case"MultiLineString":return i<0&&(i=u.length+i),s<0&&(s=u[i].length+s),d(u[i][s],a,e);case"MultiPolygon":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),s<0&&(s=u[i][o].length-s),d(u[i][o][s],a,e)}throw new Error("geojson is invalid")}var it=Object.freeze({__proto__:null,coordAll:Z,coordEach:B,coordReduce:z,featureEach:U,featureReduce:V,findPoint:rt,findSegment:nt,flattenEach:J,flattenReduce:Q,geomEach:H,geomReduce:W,lineEach:tt,lineReduce:et,propEach:X,propReduce:j,segmentEach:K,segmentReduce:$});function ot(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(null!=t.bbox&&!0!==e.recompute)return t.bbox;var n=[1/0,1/0,-1/0,-1/0];return B(t,(function(t){n[0]>t[0]&&(n[0]=t[0]),n[1]>t[1]&&(n[1]=t[1]),n[2]<t[0]&&(n[2]=t[0]),n[3]<t[1]&&(n[3]=t[1])})),n}function st(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if("Feature"===t.type&&null!==t.geometry&&"Point"===t.geometry.type)return a(t.geometry.coordinates);if("Point"===t.type)return a(t.coordinates)}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return a(t);throw new Error("coord must be GeoJSON Point or an Array of numbers")}function at(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function ut(t){if(t.length>1&&D(t[0])&&D(t[1]))return!0;if(Array.isArray(t[0])&&t[0].length)return ut(t[0]);throw new Error("coordinates must only contain numbers")}function lt(t,e,n){if(!e||!n)throw new Error("type and name required");if(!t||t.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.type)}function ht(t,e,n){if(!t)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!t||"Feature"!==t.type||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}function ct(t,e,n){if(!t)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!t||"FeatureCollection"!==t.type)throw new Error("Invalid input to "+n+", FeatureCollection required");var r,i=h(t.features);try{for(i.s();!(r=i.n()).done;){var o=r.value;if(!o||"Feature"!==o.type||!o.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!o.geometry||o.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+o.geometry.type)}}catch(t){i.e(t)}finally{i.f()}}function ft(t){return"Feature"===t.type?t.geometry:t}function gt(t,e){return"FeatureCollection"===t.type?"FeatureCollection":"GeometryCollection"===t.type?"GeometryCollection":"Feature"===t.type&&null!==t.geometry?t.geometry.type:t.type}ot.default=ot;var pt=Object.freeze({__proto__:null,getCoord:st,getCoords:at,containsNumber:ut,geojsonType:lt,featureOf:ht,collectionOf:ct,getGeom:ft,getType:gt}),vt={successCallback:null,verbose:!1},dt={};
|
|
2
2
|
/**
|
|
3
3
|
* @license GNU Affero General Public License.
|
|
4
4
|
* Copyright (c) 2015, 2015 Ronny Lorenz <ronny@tbi.univie.ac.at>
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
62
62
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
63
63
|
* SOFTWARE.
|
|
64
|
-
*/var yn=function(){function t(e){n(this,t),this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;r<this.length;r++)this.points[r].z=this.points[r].z||0;for(var i=0;i<this.length-1;i++){var o=this.points[i],s=this.points[i+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var a=0;a<this.centers.length-1;a++){var u=this.points[a+1].x-(this.centers[a].x+this.centers[a+1].x)/2,l=this.points[a+1].y-(this.centers[a].y+this.centers[a+1].y)/2,h=this.points[a+1].z-(this.centers[a].y+this.centers[a+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[a+1].x+this.sharpness*(this.centers[a].x+u),y:(1-this.sharpness)*this.points[a+1].y+this.sharpness*(this.centers[a].y+l),z:(1-this.sharpness)*this.points[a+1].z+this.sharpness*(this.centers[a].z+h)},{x:(1-this.sharpness)*this.points[a+1].x+this.sharpness*(this.centers[a+1].x+u),y:(1-this.sharpness)*this.points[a+1].y+this.sharpness*(this.centers[a+1].y+l),z:(1-this.sharpness)*this.points[a+1].z+this.sharpness*(this.centers[a+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return i(t,[{key:"cacheSteps",value:function(t){var e=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))>t&&(e.push(r),n=i)}return e}},{key:"vector",value:function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}}},{key:"pos",value:function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])}}]),t}();function mn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r],a=[n,o],u=[i,o],l=[i,r];return m([[s,l,u,a,s]],e.properties,{bbox:t,id:e.id})}function _n(t){return mn(ot(t))}function xn(t){var e=t[0],n=t[1],r=t[2],i=t[3];if(xe(t.slice(0,2),[r,n])>=xe(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function En(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=st(t),o=T(i[0]),s=T(i[1]),a=T(n),u=P(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a)),h=o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l)),c=R(h),f=R(l);return d([c,f],r.properties)}function kn(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s<r;s++)o.push(En(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),m([o],i)}function wn(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!0===n.final)return bn(t,e);var r=st(t),i=st(e),o=T(r[0]),s=T(i[0]),a=T(r[1]),u=T(i[1]),l=Math.sin(s-o)*Math.cos(u),h=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return R(Math.atan2(l,h))}function bn(t,e){var n=wn(e,t);return n=(n+180)%360}function In(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ot(t),r=(n[0]+n[2])/2,i=(n[1]+n[3])/2;return d([r,i],e.properties,e)}function Sn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,r=0,i=0;return B(t,(function(t){n+=t[0],r+=t[1],i++}),!0),d([n/i,r/i],e.properties)}function Nn(t){var e=[];return"FeatureCollection"===t.type?U(t,(function(t){B(t,(function(n){e.push(d(n,t.properties))}))})):B(t,(function(n){e.push(d(n,t.properties))})),k(e)}var Mn=Ln,Pn=Ln;function Ln(t,e,n){n=n||2;var r,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*n:t.length,f=Cn(t,0,c,n,!0),g=[];if(!f)return g;if(h&&(f=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=Cn(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(Bn(s));for(a.sort(qn),i=0;i<a.length;i++)Gn(a[i],n),n=Rn(n,n.next);return n}(t,e,f,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var p=n;p<c;p+=n)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?1/l:0}return Tn(f,g,n,r,i,l),g}function Cn(t,e,n,r,i){var o,s;if(i===Kn(t,e,n,r)>0)for(o=e;o<n;o+=r)s=Wn(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=Wn(o,t[o],t[o+1],s);return s&&Un(s,s.next)&&(Jn(s),s=s.next),s}function Rn(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Un(r,r.next)&&0!==jn(r.prev,r,r.next))r=r.next;else{if(Jn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Tn(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Yn(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?An(t,r,i,o):On(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),Jn(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?Tn(t=Dn(t,e,n),e,n,r,i,o,2):2===s&&Fn(t,e,n,r,i,o):Tn(Rn(t),e,n,r,i,o,1);break}}}function On(t){var e=t.prev,n=t,r=t.next;if(jn(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(zn(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&jn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function An(t,e,n,r){var i=t.prev,o=t,s=t.next;if(jn(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,l=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,c=Yn(a,u,e,n,r),f=Yn(l,h,e,n,r),g=t.prevZ,p=t.nextZ;g&&g.z>=c&&p&&p.z<=f;){if(g!==t.prev&&g!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&jn(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,p!==t.prev&&p!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&jn(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;g&&g.z>=c;){if(g!==t.prev&&g!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&jn(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&jn(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Dn(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Un(i,o)&&Vn(i,r,r.next,o)&&Zn(i,o)&&Zn(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Jn(r),Jn(r.next),r=t=o),r=r.next}while(r!==t);return r}function Fn(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Xn(s,a)){var u=Hn(s,a);return s=Rn(s,s.next),u=Rn(u,u.next),Tn(s,e,n,r,i,o),void Tn(u,e,n,r,i,o)}a=a.next}s=s.next}while(s!==t)}function qn(t,e){return t.x-e.x}function Gn(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===s)return n.prev;var u,l=n,h=n.x,c=n.y,f=1/0;r=n.next;for(;r!==l;)i>=r.x&&r.x>=h&&i!==r.x&&zn(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<f||u===f&&r.x>n.x)&&Zn(r,t)&&(n=r,f=u),r=r.next;return n}(t,e),e){var n=Hn(e,t);Rn(n,n.next)}}function Yn(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bn(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}function zn(t,e,n,r,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function Xn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Vn(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&Zn(t,e)&&Zn(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}function jn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Un(t,e){return t.x===e.x&&t.y===e.y}function Vn(t,e,n,r){return!!(Un(t,e)&&Un(n,r)||Un(t,r)&&Un(n,e))||jn(t,e,n)>0!=jn(t,e,r)>0&&jn(n,r,t)>0!=jn(n,r,e)>0}function Zn(t,e){return jn(t.prev,t,t.next)<0?jn(t,e,t.next)>=0&&jn(t,t.prev,e)>=0:jn(t,e,t.prev)<0||jn(t,t.next,e)<0}function Hn(t,e){var n=new Qn(t.i,t.x,t.y),r=new Qn(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Wn(t,e,n,r){var i=new Qn(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Jn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Qn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kn(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}function $n(t){var e=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),n=Mn(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),r.push(m([s]))}return r}function tr(t,e){if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var n=1/0,r=0;U(e,(function(e,i){var o=xe(t,e);o<n&&(r=i,n=o)}));var i=Ie(e.features[r]);return Object.assign(Object.assign({},i),{properties:Object.assign(Object.assign({},i.properties),{featureIndex:r,distanceToPoint:n})})}Ln.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Kn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Kn(t,l,h,n))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,g=r[a+1]*n,p=r[a+2]*n;c+=Math.abs((t[f]-t[p])*(t[g+1]-t[f+1])-(t[f]-t[g])*(t[p+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},Ln.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n},Mn.default=Pn;var er=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nr;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=e[o],a=o+1;if(a<this.length&&n(e[a],s)<0&&(o=a,s=e[a]),n(s,i)>=0)break;e[t]=s,t=o}e[t]=i}}]),t}();function nr(t,e){return t<e?-1:t>e?1:0}function rr(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function ir(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}var or=function(){function t(e,r,i,o){n(this,t),this.p={x:e[0],y:e[1]},this.featureId=r,this.ringId=i,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}return i(t,[{key:"isSamePoint",value:function(t){return this.p.x===t.p.x&&this.p.y===t.p.y}}]),t}();var sr=0,ar=0,ur=0;function lr(t,e){var n="Feature"===t.type?t.geometry:t,r=n.coordinates;"Polygon"!==n.type&&"MultiLineString"!==n.type||(r=[r]),"LineString"===n.type&&(r=[[r]]);for(var i=0;i<r.length;i++)for(var o=0;o<r[i].length;o++){var s=r[i][o][0],a=null;ar+=1;for(var u=0;u<r[i][o].length-1;u++){a=r[i][o][u+1];var l=new or(s,sr,ar,ur),h=new or(a,sr,ar,ur+1);l.otherEvent=h,h.otherEvent=l,rr(l,h)>0?(h.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,h.isLeftEndpoint=!1),e.push(l),e.push(h),s=a,ur+=1}}sr+=1}var hr=i((function t(e){n(this,t),this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}));function cr(t,e){if(null===t||null===e)return!1;if(t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;var n=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,i=t.rightSweepEvent.p.x,o=t.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,h=(l-a)*(i-n)-(u-s)*(o-r),c=(u-s)*(r-a)-(l-a)*(n-s),f=(i-n)*(r-a)-(o-r)*(n-s);if(0===h)return!1;var g=c/h,p=f/h;return g>=0&&g<=1&&p>=0&&p<=1&&[n+g*(i-n),r+g*(o-r)]}function fr(t,e){var n=new er([],rr);return function(t,e){if("FeatureCollection"===t.type)for(var n=t.features,r=0;r<n.length;r++)lr(n[r],e);else lr(t,e)}(t,n),function(t,e){e=e||!1;for(var n=[],r=new er([],ir);t.length;){var i=t.pop();if(i.isLeftEndpoint){for(var o=new hr(i),s=0;s<r.data.length;s++){var a=r.data[s];if(!e||a.leftSweepEvent.featureId!==i.featureId){var u=cr(o,a);!1!==u&&n.push(u)}}r.push(o)}else!1===i.isLeftEndpoint&&r.pop()}return n}(n,e)}function gr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.removeDuplicates,i=void 0===r||r,o=n.ignoreSelfIntersections,s=void 0!==o&&o,a=[];"FeatureCollection"===t.type?a=a.concat(t.features):"Feature"===t.type?a.push(t):"LineString"!==t.type&&"Polygon"!==t.type&&"MultiLineString"!==t.type&&"MultiPolygon"!==t.type||a.push(p(t)),"FeatureCollection"===e.type?a=a.concat(e.features):"Feature"===e.type?a.push(e):"LineString"!==e.type&&"Polygon"!==e.type&&"MultiLineString"!==e.type&&"MultiPolygon"!==e.type||a.push(p(e));var u=fr(k(a),s),l=[];if(i){var h={};u.forEach((function(t){var e=t.join(",");h[e]||(h[e]=!0,l.push(t))}))}else l=u;return k(l.map((function(t){return d(t)})))}function pr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e)throw new Error("lines and pt are required arguments");var r=d([1/0,1/0],{dist:1/0,index:-1,location:-1}),i=0;return J(t,(function(t){for(var o=at(t),s=0;s<o.length-1;s++){var a=d(o[s]);a.properties.dist=xe(e,a,n);var u=d(o[s+1]);u.properties.dist=xe(e,u,n);var l=xe(a,u,n),h=Math.max(a.properties.dist,u.properties.dist),c=wn(a,u),f=En(e,h,c+90,n),g=En(e,h,c-90,n),p=gr(x([f.geometry.coordinates,g.geometry.coordinates]),x([a.geometry.coordinates,u.geometry.coordinates])),v=void 0;p.features.length>0&&p.features[0]&&(v=Object.assign(Object.assign({},p.features[0]),{properties:{dist:xe(e,p.features[0],n),location:i+xe(a,p.features[0],n)}})),a.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},a),{properties:Object.assign(Object.assign({},a.properties),{index:s,location:i})})),u.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},u),{properties:Object.assign(Object.assign({},u.properties),{index:s+1,location:i+l})})),v&&v.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},v),{properties:Object.assign(Object.assign({},v.properties),{index:s})})),i+=l}})),r}function vr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=st(t),i=st(e);i[0]+=i[0]-r[0]>180?-360:r[0]-i[0]>180?360:0;var o=dr(r,i),s=O(o,"meters",n.units);return s}function dr(t,e,n){var r=n=void 0===n?c:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),l=Math.abs(u)>1e-11?s/u:Math.cos(i);return Math.sqrt(s*s+l*l*a*a)*r}function yr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=d(t):"Point"===t.type?t=p(t):ht(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=x(e):"LineString"===e.type?e=p(e):ht(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return K(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=mr(i,e,o,n);s<r&&(r=s)})),O(r,"degrees",n.units)}function mr(t,e,n,r){var i=[n[0]-e[0],n[1]-e[1]],o=_r([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return xr(t,e,{method:r.method,units:"degrees"});var s=_r(i,i);if(s<=o)return xr(t,n,{method:r.method,units:"degrees"});var a=o/s;return xr(t,[e[0]+a*i[0],e[1]+a*i[1]],{method:r.method,units:"degrees"})}function _r(t,e){return t[0]*e[0]+t[1]*e[1]}function xr(t,e,n){return"planar"===n.method?vr(t,e,n):xe(t,e,n)}function Er(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return H(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}var kr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wr;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=e[o],a=o+1;if(a<this.length&&n(e[a],s)<0&&(o=a,s=e[a]),n(s,i)>=0)break;e[t]=s,t=o}e[t]=i}}]),t}();function wr(t,e){return t<e?-1:t>e?1:0}function br(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function Ir(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}var Sr=function(){function t(e,r,i,o){n(this,t),this.p={x:e[0],y:e[1]},this.featureId=r,this.ringId=i,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}return i(t,[{key:"isSamePoint",value:function(t){return this.p.x===t.p.x&&this.p.y===t.p.y}}]),t}();var Nr=0,Mr=0,Pr=0;function Lr(t,e){var n="Feature"===t.type?t.geometry:t,r=n.coordinates;"Polygon"!==n.type&&"MultiLineString"!==n.type||(r=[r]),"LineString"===n.type&&(r=[[r]]);for(var i=0;i<r.length;i++)for(var o=0;o<r[i].length;o++){var s=r[i][o][0],a=null;Mr+=1;for(var u=0;u<r[i][o].length-1;u++){a=r[i][o][u+1];var l=new Sr(s,Nr,Mr,Pr),h=new Sr(a,Nr,Mr,Pr+1);l.otherEvent=h,h.otherEvent=l,br(l,h)>0?(h.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,h.isLeftEndpoint=!1),e.push(l),e.push(h),s=a,Pr+=1}}Nr+=1}var Cr=i((function t(e){n(this,t),this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}));function Rr(t,e){if(null===t||null===e)return!1;if(t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;var n=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,i=t.rightSweepEvent.p.x,o=t.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,h=(l-a)*(i-n)-(u-s)*(o-r),c=(u-s)*(r-a)-(l-a)*(n-s),f=(i-n)*(r-a)-(o-r)*(n-s);if(0===h)return!1;var g=c/h,p=f/h;return g>=0&&g<=1&&p>=0&&p<=1&&[n+g*(i-n),r+g*(o-r)]}function Tr(t,e){var n=new kr([],br);return function(t,e){if("FeatureCollection"===t.type)for(var n=t.features,r=0;r<n.length;r++)Lr(n[r],e);else Lr(t,e)}(t,n),function(t,e){e=e||!1;for(var n=[],r=new kr([],Ir);t.length;){var i=t.pop();if(i.isLeftEndpoint){for(var o=new Cr(i),s=0;s<r.data.length;s++){var a=r.data[s];if(!e||a.leftSweepEvent.featureId!==i.featureId){var u=Rr(o,a);!1!==u&&n.push(u)}}r.push(o)}else!1===i.isLeftEndpoint&&r.pop()}return n}(n,e)}function Or(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}function Ar(t){return W(t,(function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Dr(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Dr(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Dr(t){var e=0;if(t&&t.length>0){e+=Math.abs(Fr(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Fr(t[n]))}return e}function Fr(t){var e,n,r,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(r=u-2,i=u-1,o=0):s===u-1?(r=u-1,i=0,o=1):(r=s,i=s+1,o=s+2),e=t[r],n=t[i],a+=(qr(t[o][0])-qr(e[0]))*Math.sin(qr(n[1]));a=a*c*c/2}return a}function qr(t){return t*Math.PI/180}function Gr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return $(t,(function(t,n){var r=n.geometry.coordinates;return t+xe(r[0],r[1],e)}),0)}function Yr(t,e,n,r){if(!F(r=r||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,a,u,l=i.length,h=0,c=0;c<i.length&&!(e>=h&&c===i.length-1);c++){if(h>e&&0===o.length){if(!(s=e-h))return o.push(i[c]),x(o);a=wn(i[c],i[c-1])-180,u=En(i[c],s,a,r),o.push(u.geometry.coordinates)}if(h>=n)return(s=n-h)?(a=wn(i[c],i[c-1])-180,u=En(i[c],s,a,r),o.push(u.geometry.coordinates),x(o)):(o.push(i[c]),x(o));if(h>=e&&o.push(i[c]),c===i.length-1)return x(o);h+=xe(i[c],i[c+1],r)}if(h<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return x([f,f])}function Br(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=st(t),i=at(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o&&o+1===i.length-1&&(s="both")),zr(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function zr(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],h=e[1],c=l-a,f=h-u,g=(n[0]-a)*f-(n[1]-u)*c;if(null!==i){if(Math.abs(g)>i)return!1}else if(0!==g)return!1;return r?"start"===r?Math.abs(c)>=Math.abs(f)?c>0?a<o&&o<=l:l<=o&&o<a:f>0?u<s&&s<=h:h<=s&&s<u:"end"===r?Math.abs(c)>=Math.abs(f)?c>0?a<=o&&o<l:l<o&&o<=a:f>0?u<=s&&s<h:h<s&&s<=u:"both"===r&&(Math.abs(c)>=Math.abs(f)?c>0?a<o&&o<l:l<o&&o<a:f>0?u<s&&s<h:h<s&&s<u):Math.abs(c)>=Math.abs(f)?c>0?a<=o&&o<=l:l<=o&&o<=a:f>0?u<=s&&s<=h:h<=s&&s<=u}function Xr(t,e){var n=ft(t),r=ft(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;n<e.coordinates.length;n++)if(Ur(e.coordinates[n],t.coordinates)){r=!0;break}return r}(n,r);case"LineString":return Br(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return ye(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(t,e){for(var n=0;n<t.coordinates.length;n++){for(var r=!1,i=0;i<e.coordinates.length;i++)Ur(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(n,r);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!Br(t.coordinates[r],e))return!1;n||(n=Br(t.coordinates[r],e,{ignoreEndVertices:!0}))}return n}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){for(var n=!0,r=!1,i=0;i<t.coordinates.length;i++){if(!(r=ye(t.coordinates[i],e))){n=!1;break}r=ye(t.coordinates[i],e,{ignoreBoundary:!0})}return n&&r}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!Br(t.coordinates[n],e))return!1;return!0}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){var n=ot(e),r=ot(t);if(!jr(n,r))return!1;for(var i=!1,o=0;o<t.coordinates.length-1;o++){if(!ye(t.coordinates[o],e))return!1;if(i||(i=ye(t.coordinates[o],e,{ignoreBoundary:!0})),!i)i=ye(Vr(t.coordinates[o],t.coordinates[o+1]),e,{ignoreBoundary:!0})}return i}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var n=ot(t);if(!jr(ot(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!ye(t.coordinates[0][r],e))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function jr(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function Ur(t,e){return t[0]===e[0]&&t[1]===e[1]}function Vr(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function Zr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/xe([i,o],[s,o],n),l=u*(s-i),h=e/xe([i,o],[i,a],n),c=h*(a-o),f=s-i,g=a-o,p=Math.floor(f/l),v=Math.floor(g/c),y=(f-p*l)/2,m=(g-v*c)/2,_=i+y;_<=s;){for(var x=o+m;x<=a;){var E=d([_,x],n.properties);n.mask?Xr(E,n.mask)&&r.push(E):r.push(E),x+=c}_+=l}return k(r)}function Hr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.precision,r=e.coordinates,i=e.mutate;if(n=null==n||isNaN(n)?6:n,r=null==r||isNaN(r)?3:r,!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof r)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return B(t,(function(t){Wr(t,o,r)})),t}function Wr(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r<t.length;r++)t[r]=Math.round(t[r]*e)/e;return t}function Jr(t){if(!t)throw new Error("geojson is required");var e=[];return J(t,(function(t){e.push(t)})),k(e)}function Qr(t,e,n){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var s=[],a=0;a<r.length;a++)for(var u=0;u<r[a].length-1;u++)s.push(v(a,u));var l=new Nt;l.load(s)}for(var h=0;h<r.length;h++)for(var c=0;c<r[h].length-1;c++){if(n)l.search(v(h,c)).forEach((function(t){var e=t.ring,n=t.edge;p(h,c,e,n)}));else for(var f=0;f<r.length;f++)for(var g=0;g<r[f].length-1;g++)p(h,c,f,g)}return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function p(t,n,s,a){var u,l,h=r[t][n],c=r[t][n+1],f=r[s][a],g=r[s][a+1],p=function(t,e,n,r){if(Kr(t,n)||Kr(t,r)||Kr(e,n)||Kr(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],l=n[1],h=r[0],c=r[1],f=(i-s)*(l-c)-(o-a)*(u-h);return 0===f?null:[((i*a-o*s)*(u-h)-(i-s)*(u*c-l*h))/f,((i*a-o*s)*(l-c)-(o-a)*(u*c-l*h))/f]}(h,c,f,g);if(null!==p&&(u=c[0]!==h[0]?(p[0]-h[0])/(c[0]-h[0]):(p[1]-h[1])/(c[1]-h[1]),l=g[0]!==f[0]?(p[0]-f[0])/(g[0]-f[0]):(p[1]-f[1])/(g[1]-f[1]),!(u>=1||u<=0||l>=1||l<=0))){var v=p,d=!o[v];d&&(o[v]=!0),e?i.push(e(p,t,n,h,c,u,s,a,f,g,l,d)):i.push(p)}}function v(t,e){var n,i,o,s,a=r[t][e],u=r[t][e+1];return a[0]<u[0]?(n=a[0],i=u[0]):(n=u[0],i=a[0]),a[1]<u[1]?(o=a[1],s=u[1]):(o=u[1],s=a[1]),{minX:n,minY:o,maxX:i,maxY:s,ring:t,edge:e}}}function Kr(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!Kr(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}function $r(t){if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,n=[],r=0;r<e;r++){var i=t.geometry.coordinates[r];ii(i[0],i[i.length-1])||i.push(i[0]),n.push.apply(n,i.slice(0,i.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(Object.prototype.hasOwnProperty.call(e,t[r])){n=0;break}e[t[r]]=1}return n}(n))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=n.length,s=Qr(t,(function(t,e,n,r,i,o,s,a,u,l,h,c){return[t,e,n,r,i,o,s,a,u,l,h,c]})),a=s.length;if(0==a){var u=[];for(r=0;r<e;r++)u.push(m([t.geometry.coordinates[r]],{parent:-1,winding:ri(t.geometry.coordinates[r])}));var l=k(u);return q(),G(),l}var h=[],c=[];for(r=0;r<e;r++){h.push([]);for(var f=0;f<t.geometry.coordinates[r].length-1;f++)h[r].push([new ti(t.geometry.coordinates[r][oi(f+1,t.geometry.coordinates[r].length-1)],1,[r,f],[r,oi(f+1,t.geometry.coordinates[r].length-1)],void 0)]),c.push(new ei(t.geometry.coordinates[r][f],[r,oi(f-1,t.geometry.coordinates[r].length-1)],[r,f],void 0,void 0,!1,!0))}for(r=0;r<a;r++)h[s[r][1]][s[r][2]].push(new ti(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&c.push(new ei(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var g=c.length;for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)h[r][f].sort((function(t,e){return t.param<e.param?-1:1}));var p=[];for(r=0;r<g;r++)p.push({minX:c[r].coord[0],minY:c[r].coord[1],maxX:c[r].coord[0],maxY:c[r].coord[1],index:r});var v=new Nt;v.load(p);for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)for(var d=0;d<h[r][f].length;d++){_=d==h[r][f].length-1?h[r][oi(f+1,t.geometry.coordinates[r].length-1)][0].coord:h[r][f][d+1].coord;var y=v.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0];h[r][f][d].nxtIsectAlongEdgeIn=y.index}for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)for(d=0;d<h[r][f].length;d++){var _=h[r][f][d].coord,x=(y=v.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0]).index;x<o?c[x].nxtIsectAlongRingAndEdge2=h[r][f][d].nxtIsectAlongEdgeIn:ii(c[x].ringAndEdge1,h[r][f][d].ringAndEdgeIn)?c[x].nxtIsectAlongRingAndEdge1=h[r][f][d].nxtIsectAlongEdgeIn:c[x].nxtIsectAlongRingAndEdge2=h[r][f][d].nxtIsectAlongEdgeIn}var E=[];for(r=0,f=0;f<e;f++){var w=r;for(d=0;d<t.geometry.coordinates[f].length-1;d++)c[r].coord[0]<c[w].coord[0]&&(w=r),r++;var b=c[w].nxtIsectAlongRingAndEdge2;for(d=0;d<c.length;d++)if(c[d].nxtIsectAlongRingAndEdge1==w||c[d].nxtIsectAlongRingAndEdge2==w){var I=d;break}var S=ni([c[I].coord,c[w].coord,c[b].coord],!0)?1:-1;E.push({isect:w,parent:-1,winding:S})}E.sort((function(t,e){return c[t.isect].coord>c[e.isect].coord?-1:1}));for(u=[];E.length>0;){var N=E.pop(),M=N.isect,P=N.parent,L=N.winding,C=u.length,R=[c[M].coord],T=M;if(c[M].ringAndEdge1Walkable)var O=c[M].ringAndEdge1,A=c[M].nxtIsectAlongRingAndEdge1;else O=c[M].ringAndEdge2,A=c[M].nxtIsectAlongRingAndEdge2;for(;!ii(c[M].coord,c[A].coord);){R.push(c[A].coord);var D=void 0;for(r=0;r<E.length;r++)if(E[r].isect==A){D=r;break}if(null!=D&&E.splice(D,1),ii(O,c[A].ringAndEdge1)){if(O=c[A].ringAndEdge2,c[A].ringAndEdge2Walkable=!1,c[A].ringAndEdge1Walkable){var F={isect:A};ni([c[T].coord,c[A].coord,c[c[A].nxtIsectAlongRingAndEdge2].coord],1==L)?(F.parent=P,F.winding=-L):(F.parent=C,F.winding=L),E.push(F)}T=A,A=c[A].nxtIsectAlongRingAndEdge2}else{if(O=c[A].ringAndEdge1,c[A].ringAndEdge1Walkable=!1,c[A].ringAndEdge2Walkable){F={isect:A};ni([c[T].coord,c[A].coord,c[c[A].nxtIsectAlongRingAndEdge1].coord],1==L)?(F.parent=P,F.winding=-L):(F.parent=C,F.winding=L),E.push(F)}T=A,A=c[A].nxtIsectAlongRingAndEdge1}}R.push(c[A].coord),u.push(m([R],{index:C,parent:P,winding:L,netWinding:void 0}))}l=k(u);function q(){for(var t=[],e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&t.push(e);if(t.length>1)for(e=0;e<t.length;e++){for(var n=-1,r=0;r<l.features.length;r++)t[e]!=r&&ye(l.features[t[e]].geometry.coordinates[0][0],l.features[r],{ignoreBoundary:!0})&&Ar(l.features[r])<Infinity&&(n=r);l.features[t[e]].properties.parent=n}}function G(){for(var t=0;t<l.features.length;t++)if(-1==l.features[t].properties.parent){var e=l.features[t].properties.winding;l.features[t].properties.netWinding=e,Y(t,e)}}function Y(t,e){for(var n=0;n<l.features.length;n++)if(l.features[n].properties.parent==t){var r=e+l.features[n].properties.winding;l.features[n].properties.netWinding=r,Y(n,r)}}return q(),G(),l}var ti=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},ei=function(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};function ni(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function ri(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(ni([t[oi(e-1,t.length-1)],t[e],t[oi(e+1,t.length-1)]],!0))var r=1;else r=-1;return r}function ii(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!ii(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function oi(t,e){return(t%e+e)%e}
|
|
64
|
+
*/var yn=function(){function t(e){n(this,t),this.points=e.points||[],this.duration=e.duration||1e4,this.sharpness=e.sharpness||.85,this.centers=[],this.controls=[],this.stepLength=e.stepLength||60,this.length=this.points.length,this.delay=0;for(var r=0;r<this.length;r++)this.points[r].z=this.points[r].z||0;for(var i=0;i<this.length-1;i++){var o=this.points[i],s=this.points[i+1];this.centers.push({x:(o.x+s.x)/2,y:(o.y+s.y)/2,z:(o.z+s.z)/2})}this.controls.push([this.points[0],this.points[0]]);for(var a=0;a<this.centers.length-1;a++){var u=this.points[a+1].x-(this.centers[a].x+this.centers[a+1].x)/2,l=this.points[a+1].y-(this.centers[a].y+this.centers[a+1].y)/2,h=this.points[a+1].z-(this.centers[a].y+this.centers[a+1].z)/2;this.controls.push([{x:(1-this.sharpness)*this.points[a+1].x+this.sharpness*(this.centers[a].x+u),y:(1-this.sharpness)*this.points[a+1].y+this.sharpness*(this.centers[a].y+l),z:(1-this.sharpness)*this.points[a+1].z+this.sharpness*(this.centers[a].z+h)},{x:(1-this.sharpness)*this.points[a+1].x+this.sharpness*(this.centers[a+1].x+u),y:(1-this.sharpness)*this.points[a+1].y+this.sharpness*(this.centers[a+1].y+l),z:(1-this.sharpness)*this.points[a+1].z+this.sharpness*(this.centers[a+1].z+h)}])}return this.controls.push([this.points[this.length-1],this.points[this.length-1]]),this.steps=this.cacheSteps(this.stepLength),this}return i(t,[{key:"cacheSteps",value:function(t){var e=[],n=this.pos(0);e.push(0);for(var r=0;r<this.duration;r+=10){var i=this.pos(r);Math.sqrt((i.x-n.x)*(i.x-n.x)+(i.y-n.y)*(i.y-n.y)+(i.z-n.z)*(i.z-n.z))>t&&(e.push(r),n=i)}return e}},{key:"vector",value:function(t){var e=this.pos(t+10),n=this.pos(t-10);return{angle:180*Math.atan2(e.y-n.y,e.x-n.x)/3.14,speed:Math.sqrt((n.x-e.x)*(n.x-e.x)+(n.y-e.y)*(n.y-e.y)+(n.z-e.z)*(n.z-e.z))}}},{key:"pos",value:function(t){var e=t-this.delay;e<0&&(e=0),e>this.duration&&(e=this.duration-1);var n=e/this.duration;if(n>=1)return this.points[this.length-1];var r=Math.floor((this.points.length-1)*n);return function(t,e,n,r,i){var o=function(t){var e=t*t;return[e*t,3*e*(1-t),3*t*(1-t)*(1-t),(1-t)*(1-t)*(1-t)]}(t);return{x:i.x*o[0]+r.x*o[1]+n.x*o[2]+e.x*o[3],y:i.y*o[0]+r.y*o[1]+n.y*o[2]+e.y*o[3],z:i.z*o[0]+r.z*o[1]+n.z*o[2]+e.z*o[3]}}((this.length-1)*n-r,this.points[r],this.controls[r][1],this.controls[r+1][0],this.points[r+1])}}]),t}();function mn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=Number(t[0]),r=Number(t[1]),i=Number(t[2]),o=Number(t[3]);if(6===t.length)throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");var s=[n,r],a=[n,o],u=[i,o],l=[i,r];return m([[s,l,u,a,s]],e.properties,{bbox:t,id:e.id})}function _n(t){return mn(ot(t))}function xn(t){var e=t[0],n=t[1],r=t[2],i=t[3];if(xe(t.slice(0,2),[r,n])>=xe(t.slice(0,2),[e,i])){var o=(n+i)/2;return[e,o-(r-e)/2,r,o+(r-e)/2]}var s=(e+r)/2;return[s-(i-n)/2,n,s+(i-n)/2,i]}function En(t,e,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},i=st(t),o=T(i[0]),s=T(i[1]),a=T(n),u=P(e,r.units),l=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(a)),h=o+Math.atan2(Math.sin(a)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(l)),c=R(h),f=R(l);return d([c,f],r.properties)}function kn(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.steps||64,i=n.properties?n.properties:!Array.isArray(t)&&"Feature"===t.type&&t.properties?t.properties:{},o=[],s=0;s<r;s++)o.push(En(t,e,-360*s/r,n).geometry.coordinates);return o.push(o[0]),m([o],i)}function wn(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!0===n.final)return bn(t,e);var r=st(t),i=st(e),o=T(r[0]),s=T(i[0]),a=T(r[1]),u=T(i[1]),l=Math.sin(s-o)*Math.cos(u),h=Math.cos(a)*Math.sin(u)-Math.sin(a)*Math.cos(u)*Math.cos(s-o);return R(Math.atan2(l,h))}function bn(t,e){var n=wn(e,t);return n=(n+180)%360}function In(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=ot(t),r=(n[0]+n[2])/2,i=(n[1]+n[3])/2;return d([r,i],e.properties,e)}function Sn(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=0,r=0,i=0;return B(t,(function(t){n+=t[0],r+=t[1],i++}),!0),d([n/i,r/i],e.properties)}function Nn(t){var e=[];return"FeatureCollection"===t.type?U(t,(function(t){B(t,(function(n){e.push(d(n,t.properties))}))})):B(t,(function(n){e.push(d(n,t.properties))})),k(e)}var Mn=Ln,Pn=Ln;function Ln(t,e,n){n=n||2;var r,i,o,s,a,u,l,h=e&&e.length,c=h?e[0]*n:t.length,f=Cn(t,0,c,n,!0),g=[];if(!f)return g;if(h&&(f=function(t,e,n,r){var i,o,s,a=[];for(i=0,o=e.length;i<o;i++)(s=Cn(t,e[i]*r,i<o-1?e[i+1]*r:t.length,r,!1))===s.next&&(s.steiner=!0),a.push(Bn(s));for(a.sort(qn),i=0;i<a.length;i++)Gn(a[i],n),n=Rn(n,n.next);return n}(t,e,f,n)),t.length>80*n){r=o=t[0],i=s=t[1];for(var p=n;p<c;p+=n)(a=t[p])<r&&(r=a),(u=t[p+1])<i&&(i=u),a>o&&(o=a),u>s&&(s=u);l=0!==(l=Math.max(o-r,s-i))?1/l:0}return Tn(f,g,n,r,i,l),g}function Cn(t,e,n,r,i){var o,s;if(i===Kn(t,e,n,r)>0)for(o=e;o<n;o+=r)s=Wn(o,t[o],t[o+1],s);else for(o=n-r;o>=e;o-=r)s=Wn(o,t[o],t[o+1],s);return s&&Un(s,s.next)&&(Jn(s),s=s.next),s}function Rn(t,e){if(!t)return t;e||(e=t);var n,r=t;do{if(n=!1,r.steiner||!Un(r,r.next)&&0!==jn(r.prev,r,r.next))r=r.next;else{if(Jn(r),(r=e=r.prev)===r.next)break;n=!0}}while(n||r!==e);return e}function Tn(t,e,n,r,i,o,s){if(t){!s&&o&&function(t,e,n,r){var i=t;do{null===i.z&&(i.z=Yn(i.x,i.y,e,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next}while(i!==t);i.prevZ.nextZ=null,i.prevZ=null,function(t){var e,n,r,i,o,s,a,u,l=1;do{for(n=t,t=null,o=null,s=0;n;){for(s++,r=n,a=0,e=0;e<l&&(a++,r=r.nextZ);e++);for(u=l;a>0||u>0&&r;)0!==a&&(0===u||!r||n.z<=r.z)?(i=n,n=n.nextZ,a--):(i=r,r=r.nextZ,u--),o?o.nextZ=i:t=i,i.prevZ=o,o=i;n=r}o.nextZ=null,l*=2}while(s>1)}(i)}(t,r,i,o);for(var a,u,l=t;t.prev!==t.next;)if(a=t.prev,u=t.next,o?An(t,r,i,o):On(t))e.push(a.i/n),e.push(t.i/n),e.push(u.i/n),Jn(t),t=u.next,l=u.next;else if((t=u)===l){s?1===s?Tn(t=Dn(t,e,n),e,n,r,i,o,2):2===s&&Fn(t,e,n,r,i,o):Tn(Rn(t),e,n,r,i,o,1);break}}}function On(t){var e=t.prev,n=t,r=t.next;if(jn(e,n,r)>=0)return!1;for(var i=t.next.next;i!==t.prev;){if(zn(e.x,e.y,n.x,n.y,r.x,r.y,i.x,i.y)&&jn(i.prev,i,i.next)>=0)return!1;i=i.next}return!0}function An(t,e,n,r){var i=t.prev,o=t,s=t.next;if(jn(i,o,s)>=0)return!1;for(var a=i.x<o.x?i.x<s.x?i.x:s.x:o.x<s.x?o.x:s.x,u=i.y<o.y?i.y<s.y?i.y:s.y:o.y<s.y?o.y:s.y,l=i.x>o.x?i.x>s.x?i.x:s.x:o.x>s.x?o.x:s.x,h=i.y>o.y?i.y>s.y?i.y:s.y:o.y>s.y?o.y:s.y,c=Yn(a,u,e,n,r),f=Yn(l,h,e,n,r),g=t.prevZ,p=t.nextZ;g&&g.z>=c&&p&&p.z<=f;){if(g!==t.prev&&g!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&jn(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,p!==t.prev&&p!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&jn(p.prev,p,p.next)>=0)return!1;p=p.nextZ}for(;g&&g.z>=c;){if(g!==t.prev&&g!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,g.x,g.y)&&jn(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;p&&p.z<=f;){if(p!==t.prev&&p!==t.next&&zn(i.x,i.y,o.x,o.y,s.x,s.y,p.x,p.y)&&jn(p.prev,p,p.next)>=0)return!1;p=p.nextZ}return!0}function Dn(t,e,n){var r=t;do{var i=r.prev,o=r.next.next;!Un(i,o)&&Vn(i,r,r.next,o)&&Zn(i,o)&&Zn(o,i)&&(e.push(i.i/n),e.push(r.i/n),e.push(o.i/n),Jn(r),Jn(r.next),r=t=o),r=r.next}while(r!==t);return r}function Fn(t,e,n,r,i,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&Xn(s,a)){var u=Hn(s,a);return s=Rn(s,s.next),u=Rn(u,u.next),Tn(s,e,n,r,i,o),void Tn(u,e,n,r,i,o)}a=a.next}s=s.next}while(s!==t)}function qn(t,e){return t.x-e.x}function Gn(t,e){if(e=function(t,e){var n,r=e,i=t.x,o=t.y,s=-1/0;do{if(o<=r.y&&o>=r.next.y&&r.next.y!==r.y){var a=r.x+(o-r.y)*(r.next.x-r.x)/(r.next.y-r.y);if(a<=i&&a>s){if(s=a,a===i){if(o===r.y)return r;if(o===r.next.y)return r.next}n=r.x<r.next.x?r:r.next}}r=r.next}while(r!==e);if(!n)return null;if(i===s)return n.prev;var u,l=n,h=n.x,c=n.y,f=1/0;r=n.next;for(;r!==l;)i>=r.x&&r.x>=h&&i!==r.x&&zn(o<c?i:s,o,h,c,o<c?s:i,o,r.x,r.y)&&((u=Math.abs(o-r.y)/(i-r.x))<f||u===f&&r.x>n.x)&&Zn(r,t)&&(n=r,f=u),r=r.next;return n}(t,e),e){var n=Hn(e,t);Rn(n,n.next)}}function Yn(t,e,n,r,i){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=32767*(t-n)*i)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=32767*(e-r)*i)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function Bn(t){var e=t,n=t;do{e.x<n.x&&(n=e),e=e.next}while(e!==t);return n}function zn(t,e,n,r,i,o,s,a){return(i-s)*(e-a)-(t-s)*(o-a)>=0&&(t-s)*(r-a)-(n-s)*(e-a)>=0&&(n-s)*(o-a)-(i-s)*(r-a)>=0}function Xn(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var n=t;do{if(n.i!==t.i&&n.next.i!==t.i&&n.i!==e.i&&n.next.i!==e.i&&Vn(n,n.next,t,e))return!0;n=n.next}while(n!==t);return!1}(t,e)&&Zn(t,e)&&Zn(e,t)&&function(t,e){var n=t,r=!1,i=(t.x+e.x)/2,o=(t.y+e.y)/2;do{n.y>o!=n.next.y>o&&n.next.y!==n.y&&i<(n.next.x-n.x)*(o-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next}while(n!==t);return r}(t,e)}function jn(t,e,n){return(e.y-t.y)*(n.x-e.x)-(e.x-t.x)*(n.y-e.y)}function Un(t,e){return t.x===e.x&&t.y===e.y}function Vn(t,e,n,r){return!!(Un(t,e)&&Un(n,r)||Un(t,r)&&Un(n,e))||jn(t,e,n)>0!=jn(t,e,r)>0&&jn(n,r,t)>0!=jn(n,r,e)>0}function Zn(t,e){return jn(t.prev,t,t.next)<0?jn(t,e,t.next)>=0&&jn(t,t.prev,e)>=0:jn(t,e,t.prev)<0||jn(t,t.next,e)<0}function Hn(t,e){var n=new Qn(t.i,t.x,t.y),r=new Qn(e.i,e.x,e.y),i=t.next,o=e.prev;return t.next=e,e.prev=t,n.next=i,i.prev=n,r.next=n,n.prev=r,o.next=r,r.prev=o,r}function Wn(t,e,n,r){var i=new Qn(t,e,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Jn(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function Qn(t,e,n){this.i=t,this.x=e,this.y=n,this.prev=null,this.next=null,this.z=null,this.prevZ=null,this.nextZ=null,this.steiner=!1}function Kn(t,e,n,r){for(var i=0,o=e,s=n-r;o<n;o+=r)i+=(t[s]-t[o])*(t[o+1]+t[s+1]),s=o;return i}function $n(t){var e=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n}(t),n=Mn(e.vertices,e.holes,2),r=[],i=[];n.forEach((function(t,r){var o=n[r];i.push([e.vertices[2*o],e.vertices[2*o+1]])}));for(var o=0;o<i.length;o+=3){var s=i.slice(o,o+3);s.push(i[o]),r.push(m([s]))}return r}function tr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)throw new Error("targetPoint is required");if(!e)throw new Error("points is required");var r=1/0,i=0;U(e,(function(e,o){var s=xe(t,e,n);s<r&&(i=o,r=s)}));var o=Ie(e.features[i]);return Object.assign(Object.assign({},o),{properties:Object.assign(Object.assign({},o.properties),{featureIndex:i,distanceToPoint:r})})}Ln.deviation=function(t,e,n,r){var i=e&&e.length,o=i?e[0]*n:t.length,s=Math.abs(Kn(t,0,o,n));if(i)for(var a=0,u=e.length;a<u;a++){var l=e[a]*n,h=a<u-1?e[a+1]*n:t.length;s-=Math.abs(Kn(t,l,h,n))}var c=0;for(a=0;a<r.length;a+=3){var f=r[a]*n,g=r[a+1]*n,p=r[a+2]*n;c+=Math.abs((t[f]-t[p])*(t[g+1]-t[f+1])-(t[f]-t[g])*(t[p+1]-t[f+1]))}return 0===s&&0===c?0:Math.abs((c-s)/s)},Ln.flatten=function(t){for(var e=t[0][0].length,n={vertices:[],holes:[],dimensions:e},r=0,i=0;i<t.length;i++){for(var o=0;o<t[i].length;o++)for(var s=0;s<e;s++)n.vertices.push(t[i][o][s]);i>0&&(r+=t[i-1].length,n.holes.push(r))}return n},Mn.default=Pn;var er=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:nr;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=e[o],a=o+1;if(a<this.length&&n(e[a],s)<0&&(o=a,s=e[a]),n(s,i)>=0)break;e[t]=s,t=o}e[t]=i}}]),t}();function nr(t,e){return t<e?-1:t>e?1:0}function rr(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function ir(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}var or=function(){function t(e,r,i,o){n(this,t),this.p={x:e[0],y:e[1]},this.featureId=r,this.ringId=i,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}return i(t,[{key:"isSamePoint",value:function(t){return this.p.x===t.p.x&&this.p.y===t.p.y}}]),t}();var sr=0,ar=0,ur=0;function lr(t,e){var n="Feature"===t.type?t.geometry:t,r=n.coordinates;"Polygon"!==n.type&&"MultiLineString"!==n.type||(r=[r]),"LineString"===n.type&&(r=[[r]]);for(var i=0;i<r.length;i++)for(var o=0;o<r[i].length;o++){var s=r[i][o][0],a=null;ar+=1;for(var u=0;u<r[i][o].length-1;u++){a=r[i][o][u+1];var l=new or(s,sr,ar,ur),h=new or(a,sr,ar,ur+1);l.otherEvent=h,h.otherEvent=l,rr(l,h)>0?(h.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,h.isLeftEndpoint=!1),e.push(l),e.push(h),s=a,ur+=1}}sr+=1}var hr=i((function t(e){n(this,t),this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}));function cr(t,e){if(null===t||null===e)return!1;if(t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;var n=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,i=t.rightSweepEvent.p.x,o=t.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,h=(l-a)*(i-n)-(u-s)*(o-r),c=(u-s)*(r-a)-(l-a)*(n-s),f=(i-n)*(r-a)-(o-r)*(n-s);if(0===h)return!1;var g=c/h,p=f/h;return g>=0&&g<=1&&p>=0&&p<=1&&[n+g*(i-n),r+g*(o-r)]}function fr(t,e){var n=new er([],rr);return function(t,e){if("FeatureCollection"===t.type)for(var n=t.features,r=0;r<n.length;r++)lr(n[r],e);else lr(t,e)}(t,n),function(t,e){e=e||!1;for(var n=[],r=new er([],ir);t.length;){var i=t.pop();if(i.isLeftEndpoint){for(var o=new hr(i),s=0;s<r.data.length;s++){var a=r.data[s];if(!e||a.leftSweepEvent.featureId!==i.featureId){var u=cr(o,a);!1!==u&&n.push(u)}}r.push(o)}else!1===i.isLeftEndpoint&&r.pop()}return n}(n,e)}function gr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=n.removeDuplicates,i=void 0===r||r,o=n.ignoreSelfIntersections,s=void 0!==o&&o,a=[];"FeatureCollection"===t.type?a=a.concat(t.features):"Feature"===t.type?a.push(t):"LineString"!==t.type&&"Polygon"!==t.type&&"MultiLineString"!==t.type&&"MultiPolygon"!==t.type||a.push(p(t)),"FeatureCollection"===e.type?a=a.concat(e.features):"Feature"===e.type?a.push(e):"LineString"!==e.type&&"Polygon"!==e.type&&"MultiLineString"!==e.type&&"MultiPolygon"!==e.type||a.push(p(e));var u=fr(k(a),s),l=[];if(i){var h={};u.forEach((function(t){var e=t.join(",");h[e]||(h[e]=!0,l.push(t))}))}else l=u;return k(l.map((function(t){return d(t)})))}function pr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t||!e)throw new Error("lines and pt are required arguments");var r=d([1/0,1/0],{dist:1/0,index:-1,location:-1}),i=0;return J(t,(function(t){for(var o=at(t),s=0;s<o.length-1;s++){var a=d(o[s]);a.properties.dist=xe(e,a,n);var u=d(o[s+1]);u.properties.dist=xe(e,u,n);var l=xe(a,u,n),h=Math.max(a.properties.dist,u.properties.dist),c=wn(a,u),f=En(e,h,c+90,n),g=En(e,h,c-90,n),p=gr(x([f.geometry.coordinates,g.geometry.coordinates]),x([a.geometry.coordinates,u.geometry.coordinates])),v=void 0;p.features.length>0&&p.features[0]&&(v=Object.assign(Object.assign({},p.features[0]),{properties:{dist:xe(e,p.features[0],n),location:i+xe(a,p.features[0],n)}})),a.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},a),{properties:Object.assign(Object.assign({},a.properties),{index:s,location:i})})),u.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},u),{properties:Object.assign(Object.assign({},u.properties),{index:s+1,location:i+l})})),v&&v.properties.dist<r.properties.dist&&(r=Object.assign(Object.assign({},v),{properties:Object.assign(Object.assign({},v.properties),{index:s})})),i+=l}})),r}function vr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=st(t),i=st(e);i[0]+=i[0]-r[0]>180?-360:r[0]-i[0]>180?360:0;var o=dr(r,i),s=O(o,"meters",n.units);return s}function dr(t,e,n){var r=n=void 0===n?c:Number(n),i=t[1]*Math.PI/180,o=e[1]*Math.PI/180,s=o-i,a=Math.abs(e[0]-t[0])*Math.PI/180;a>Math.PI&&(a-=2*Math.PI);var u=Math.log(Math.tan(o/2+Math.PI/4)/Math.tan(i/2+Math.PI/4)),l=Math.abs(u)>1e-11?s/u:Math.cos(i);return Math.sqrt(s*s+l*l*a*a)*r}function yr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(n.method||(n.method="geodesic"),n.units||(n.units="kilometers"),!t)throw new Error("pt is required");if(Array.isArray(t)?t=d(t):"Point"===t.type?t=p(t):ht(t,"Point","point"),!e)throw new Error("line is required");Array.isArray(e)?e=x(e):"LineString"===e.type?e=p(e):ht(e,"LineString","line");var r=1/0,i=t.geometry.coordinates;return K(e,(function(t){var e=t.geometry.coordinates[0],o=t.geometry.coordinates[1],s=mr(i,e,o,n);s<r&&(r=s)})),O(r,"degrees",n.units)}function mr(t,e,n,r){var i=[n[0]-e[0],n[1]-e[1]],o=_r([t[0]-e[0],t[1]-e[1]],i);if(o<=0)return xr(t,e,{method:r.method,units:"degrees"});var s=_r(i,i);if(s<=o)return xr(t,n,{method:r.method,units:"degrees"});var a=o/s;return xr(t,[e[0]+a*i[0],e[1]+a*i[1]],{method:r.method,units:"degrees"})}function _r(t,e){return t[0]*e[0]+t[1]*e[1]}function xr(t,e,n){return"planar"===n.method?vr(t,e,n):xe(t,e,n)}function Er(t){var e=[];switch(t.geometry?t.geometry.type:t.type){case"GeometryCollection":return H(t,(function(t){"Point"===t.type&&e.push({type:"Feature",properties:{},geometry:t})})),{type:"FeatureCollection",features:e};case"FeatureCollection":return t.features=t.features.filter((function(t){return"Point"===t.geometry.type})),t;default:throw new Error("points must be a Point Collection")}}var kr=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:wr;if(n(this,t),this.data=e,this.length=this.data.length,this.compare=r,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)}return i(t,[{key:"push",value:function(t){this.data.push(t),this.length++,this._up(this.length-1)}},{key:"pop",value:function(){if(0!==this.length){var t=this.data[0],e=this.data.pop();return this.length--,this.length>0&&(this.data[0]=e,this._down(0)),t}}},{key:"peek",value:function(){return this.data[0]}},{key:"_up",value:function(t){for(var e=this.data,n=this.compare,r=e[t];t>0;){var i=t-1>>1,o=e[i];if(n(r,o)>=0)break;e[t]=o,t=i}e[t]=r}},{key:"_down",value:function(t){for(var e=this.data,n=this.compare,r=this.length>>1,i=e[t];t<r;){var o=1+(t<<1),s=e[o],a=o+1;if(a<this.length&&n(e[a],s)<0&&(o=a,s=e[a]),n(s,i)>=0)break;e[t]=s,t=o}e[t]=i}}]),t}();function wr(t,e){return t<e?-1:t>e?1:0}function br(t,e){return t.p.x>e.p.x?1:t.p.x<e.p.x?-1:t.p.y!==e.p.y?t.p.y>e.p.y?1:-1:1}function Ir(t,e){return t.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:t.rightSweepEvent.p.x<e.rightSweepEvent.p.x?-1:t.rightSweepEvent.p.y!==e.rightSweepEvent.p.y?t.rightSweepEvent.p.y<e.rightSweepEvent.p.y?1:-1:1}var Sr=function(){function t(e,r,i,o){n(this,t),this.p={x:e[0],y:e[1]},this.featureId=r,this.ringId=i,this.eventId=o,this.otherEvent=null,this.isLeftEndpoint=null}return i(t,[{key:"isSamePoint",value:function(t){return this.p.x===t.p.x&&this.p.y===t.p.y}}]),t}();var Nr=0,Mr=0,Pr=0;function Lr(t,e){var n="Feature"===t.type?t.geometry:t,r=n.coordinates;"Polygon"!==n.type&&"MultiLineString"!==n.type||(r=[r]),"LineString"===n.type&&(r=[[r]]);for(var i=0;i<r.length;i++)for(var o=0;o<r[i].length;o++){var s=r[i][o][0],a=null;Mr+=1;for(var u=0;u<r[i][o].length-1;u++){a=r[i][o][u+1];var l=new Sr(s,Nr,Mr,Pr),h=new Sr(a,Nr,Mr,Pr+1);l.otherEvent=h,h.otherEvent=l,br(l,h)>0?(h.isLeftEndpoint=!0,l.isLeftEndpoint=!1):(l.isLeftEndpoint=!0,h.isLeftEndpoint=!1),e.push(l),e.push(h),s=a,Pr+=1}}Nr+=1}var Cr=i((function t(e){n(this,t),this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}));function Rr(t,e){if(null===t||null===e)return!1;if(t.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.leftSweepEvent)||t.rightSweepEvent.isSamePoint(e.rightSweepEvent)||t.leftSweepEvent.isSamePoint(e.leftSweepEvent)||t.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;var n=t.leftSweepEvent.p.x,r=t.leftSweepEvent.p.y,i=t.rightSweepEvent.p.x,o=t.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,a=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,l=e.rightSweepEvent.p.y,h=(l-a)*(i-n)-(u-s)*(o-r),c=(u-s)*(r-a)-(l-a)*(n-s),f=(i-n)*(r-a)-(o-r)*(n-s);if(0===h)return!1;var g=c/h,p=f/h;return g>=0&&g<=1&&p>=0&&p<=1&&[n+g*(i-n),r+g*(o-r)]}function Tr(t,e){var n=new kr([],br);return function(t,e){if("FeatureCollection"===t.type)for(var n=t.features,r=0;r<n.length;r++)Lr(n[r],e);else Lr(t,e)}(t,n),function(t,e){e=e||!1;for(var n=[],r=new kr([],Ir);t.length;){var i=t.pop();if(i.isLeftEndpoint){for(var o=new Cr(i),s=0;s<r.data.length;s++){var a=r.data[s];if(!e||a.leftSweepEvent.featureId!==i.featureId){var u=Rr(o,a);!1!==u&&n.push(u)}}r.push(o)}else!1===i.isLeftEndpoint&&r.pop()}return n}(n,e)}function Or(t,e,n,r,i,o){return Math.sqrt((i-n)*(i-n)+(o-r)*(o-r))===Math.sqrt((t-n)*(t-n)+(e-r)*(e-r))+Math.sqrt((i-t)*(i-t)+(o-e)*(o-e))}function Ar(t){return W(t,(function(t,e){return t+function(t){var e,n=0;switch(t.type){case"Polygon":return Dr(t.coordinates);case"MultiPolygon":for(e=0;e<t.coordinates.length;e++)n+=Dr(t.coordinates[e]);return n;case"Point":case"MultiPoint":case"LineString":case"MultiLineString":return 0}return 0}(e)}),0)}function Dr(t){var e=0;if(t&&t.length>0){e+=Math.abs(Fr(t[0]));for(var n=1;n<t.length;n++)e-=Math.abs(Fr(t[n]))}return e}function Fr(t){var e,n,r,i,o,s,a=0,u=t.length;if(u>2){for(s=0;s<u;s++)s===u-2?(r=u-2,i=u-1,o=0):s===u-1?(r=u-1,i=0,o=1):(r=s,i=s+1,o=s+2),e=t[r],n=t[i],a+=(qr(t[o][0])-qr(e[0]))*Math.sin(qr(n[1]));a=a*c*c/2}return a}function qr(t){return t*Math.PI/180}function Gr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return $(t,(function(t,n){var r=n.geometry.coordinates;return t+xe(r[0],r[1],e)}),0)}function Yr(t,e,n,r){if(!F(r=r||{}))throw new Error("options is invalid");var i,o=[];if("Feature"===t.type)i=t.geometry.coordinates;else{if("LineString"!==t.type)throw new Error("input must be a LineString Feature or Geometry");i=t.coordinates}for(var s,a,u,l=i.length,h=0,c=0;c<i.length&&!(e>=h&&c===i.length-1);c++){if(h>e&&0===o.length){if(!(s=e-h))return o.push(i[c]),x(o);a=wn(i[c],i[c-1])-180,u=En(i[c],s,a,r),o.push(u.geometry.coordinates)}if(h>=n)return(s=n-h)?(a=wn(i[c],i[c-1])-180,u=En(i[c],s,a,r),o.push(u.geometry.coordinates),x(o)):(o.push(i[c]),x(o));if(h>=e&&o.push(i[c]),c===i.length-1)return x(o);h+=xe(i[c],i[c+1],r)}if(h<e&&i.length===l)throw new Error("Start position is beyond line");var f=i[i.length-1];return x([f,f])}function Br(t,e){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=st(t),i=at(e),o=0;o<i.length-1;o++){var s=!1;if(n.ignoreEndVertices&&(0===o&&(s="start"),o===i.length-2&&(s="end"),0===o&&o+1===i.length-1&&(s="both")),zr(i[o],i[o+1],r,s,void 0===n.epsilon?null:n.epsilon))return!0}return!1}function zr(t,e,n,r,i){var o=n[0],s=n[1],a=t[0],u=t[1],l=e[0],h=e[1],c=l-a,f=h-u,g=(n[0]-a)*f-(n[1]-u)*c;if(null!==i){if(Math.abs(g)>i)return!1}else if(0!==g)return!1;return r?"start"===r?Math.abs(c)>=Math.abs(f)?c>0?a<o&&o<=l:l<=o&&o<a:f>0?u<s&&s<=h:h<=s&&s<u:"end"===r?Math.abs(c)>=Math.abs(f)?c>0?a<=o&&o<l:l<o&&o<=a:f>0?u<=s&&s<h:h<s&&s<=u:"both"===r&&(Math.abs(c)>=Math.abs(f)?c>0?a<o&&o<l:l<o&&o<a:f>0?u<s&&s<h:h<s&&s<u):Math.abs(c)>=Math.abs(f)?c>0?a<=o&&o<=l:l<=o&&o<=a:f>0?u<=s&&s<=h:h<=s&&s<=u}function Xr(t,e){var n=ft(t),r=ft(e),i=n.type,o=r.type;switch(i){case"Point":switch(o){case"MultiPoint":return function(t,e){var n,r=!1;for(n=0;n<e.coordinates.length;n++)if(Ur(e.coordinates[n],t.coordinates)){r=!0;break}return r}(n,r);case"LineString":return Br(n,r,{ignoreEndVertices:!0});case"Polygon":case"MultiPolygon":return ye(n,r,{ignoreBoundary:!0});default:throw new Error("feature2 "+o+" geometry not supported")}case"MultiPoint":switch(o){case"MultiPoint":return function(t,e){for(var n=0;n<t.coordinates.length;n++){for(var r=!1,i=0;i<e.coordinates.length;i++)Ur(t.coordinates[n],e.coordinates[i])&&(r=!0);if(!r)return!1}return!0}(n,r);case"LineString":return function(t,e){for(var n=!1,r=0;r<t.coordinates.length;r++){if(!Br(t.coordinates[r],e))return!1;n||(n=Br(t.coordinates[r],e,{ignoreEndVertices:!0}))}return n}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){for(var n=!0,r=!1,i=0;i<t.coordinates.length;i++){if(!(r=ye(t.coordinates[i],e))){n=!1;break}r=ye(t.coordinates[i],e,{ignoreBoundary:!0})}return n&&r}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"LineString":switch(o){case"LineString":return function(t,e){for(var n=0;n<t.coordinates.length;n++)if(!Br(t.coordinates[n],e))return!1;return!0}(n,r);case"Polygon":case"MultiPolygon":return function(t,e){var n=ot(e),r=ot(t);if(!jr(n,r))return!1;for(var i=!1,o=0;o<t.coordinates.length-1;o++){if(!ye(t.coordinates[o],e))return!1;if(i||(i=ye(t.coordinates[o],e,{ignoreBoundary:!0})),!i)i=ye(Vr(t.coordinates[o],t.coordinates[o+1]),e,{ignoreBoundary:!0})}return i}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}case"Polygon":switch(o){case"Polygon":case"MultiPolygon":return function(t,e){var n=ot(t);if(!jr(ot(e),n))return!1;for(var r=0;r<t.coordinates[0].length;r++)if(!ye(t.coordinates[0][r],e))return!1;return!0}(n,r);default:throw new Error("feature2 "+o+" geometry not supported")}default:throw new Error("feature1 "+i+" geometry not supported")}}function jr(t,e){return!(t[0]>e[0])&&(!(t[2]<e[2])&&(!(t[1]>e[1])&&!(t[3]<e[3])))}function Ur(t,e){return t[0]===e[0]&&t[1]===e[1]}function Vr(t,e){return[(t[0]+e[0])/2,(t[1]+e[1])/2]}function Zr(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};n.mask&&!n.units&&(n.units="kilometers");for(var r=[],i=t[0],o=t[1],s=t[2],a=t[3],u=e/xe([i,o],[s,o],n),l=u*(s-i),h=e/xe([i,o],[i,a],n),c=h*(a-o),f=s-i,g=a-o,p=Math.floor(f/l),v=Math.floor(g/c),y=(f-p*l)/2,m=(g-v*c)/2,_=i+y;_<=s;){for(var x=o+m;x<=a;){var E=d([_,x],n.properties);n.mask?Xr(E,n.mask)&&r.push(E):r.push(E),x+=c}_+=l}return k(r)}function Hr(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=e.precision,r=e.coordinates,i=e.mutate;if(n=null==n||isNaN(n)?6:n,r=null==r||isNaN(r)?3:r,!t)throw new Error("<geojson> is required");if("number"!=typeof n)throw new Error("<precision> must be a number");if("number"!=typeof r)throw new Error("<coordinates> must be a number");!1!==i&&void 0!==i||(t=JSON.parse(JSON.stringify(t)));var o=Math.pow(10,n);return B(t,(function(t){Wr(t,o,r)})),t}function Wr(t,e,n){t.length>n&&t.splice(n,t.length);for(var r=0;r<t.length;r++)t[r]=Math.round(t[r]*e)/e;return t}function Jr(t){if(!t)throw new Error("geojson is required");var e=[];return J(t,(function(t){e.push(t)})),k(e)}function Qr(t,e,n){if("Polygon"!==t.geometry.type)throw new Error("The input feature must be a Polygon");void 0===n&&(n=1);var r=t.geometry.coordinates,i=[],o={};if(n){for(var s=[],a=0;a<r.length;a++)for(var u=0;u<r[a].length-1;u++)s.push(v(a,u));var l=new Nt;l.load(s)}for(var h=0;h<r.length;h++)for(var c=0;c<r[h].length-1;c++){if(n)l.search(v(h,c)).forEach((function(t){var e=t.ring,n=t.edge;p(h,c,e,n)}));else for(var f=0;f<r.length;f++)for(var g=0;g<r[f].length-1;g++)p(h,c,f,g)}return e||(i={type:"Feature",geometry:{type:"MultiPoint",coordinates:i}}),i;function p(t,n,s,a){var u,l,h=r[t][n],c=r[t][n+1],f=r[s][a],g=r[s][a+1],p=function(t,e,n,r){if(Kr(t,n)||Kr(t,r)||Kr(e,n)||Kr(r,n))return null;var i=t[0],o=t[1],s=e[0],a=e[1],u=n[0],l=n[1],h=r[0],c=r[1],f=(i-s)*(l-c)-(o-a)*(u-h);return 0===f?null:[((i*a-o*s)*(u-h)-(i-s)*(u*c-l*h))/f,((i*a-o*s)*(l-c)-(o-a)*(u*c-l*h))/f]}(h,c,f,g);if(null!==p&&(u=c[0]!==h[0]?(p[0]-h[0])/(c[0]-h[0]):(p[1]-h[1])/(c[1]-h[1]),l=g[0]!==f[0]?(p[0]-f[0])/(g[0]-f[0]):(p[1]-f[1])/(g[1]-f[1]),!(u>=1||u<=0||l>=1||l<=0))){var v=p,d=!o[v];d&&(o[v]=!0),e?i.push(e(p,t,n,h,c,u,s,a,f,g,l,d)):i.push(p)}}function v(t,e){var n,i,o,s,a=r[t][e],u=r[t][e+1];return a[0]<u[0]?(n=a[0],i=u[0]):(n=u[0],i=a[0]),a[1]<u[1]?(o=a[1],s=u[1]):(o=u[1],s=a[1]),{minX:n,minY:o,maxX:i,maxY:s,ring:t,edge:e}}}function Kr(t,e){if(!t||!e)return!1;if(t.length!==e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!Kr(t[n],e[n]))return!1}else if(t[n]!==e[n])return!1;return!0}function $r(t){if("Feature"!=t.type)throw new Error("The input must a geojson object of type Feature");if(void 0===t.geometry||null==t.geometry)throw new Error("The input must a geojson object with a non-empty geometry");if("Polygon"!=t.geometry.type)throw new Error("The input must be a geojson Polygon");for(var e=t.geometry.coordinates.length,n=[],r=0;r<e;r++){var i=t.geometry.coordinates[r];ii(i[0],i[i.length-1])||i.push(i[0]),n.push.apply(n,i.slice(0,i.length-1))}if(!function(t){for(var e={},n=1,r=0,i=t.length;r<i;++r){if(Object.prototype.hasOwnProperty.call(e,t[r])){n=0;break}e[t[r]]=1}return n}(n))throw new Error("The input polygon may not have duplicate vertices (except for the first and last vertex of each ring)");var o=n.length,s=Qr(t,(function(t,e,n,r,i,o,s,a,u,l,h,c){return[t,e,n,r,i,o,s,a,u,l,h,c]})),a=s.length;if(0==a){var u=[];for(r=0;r<e;r++)u.push(m([t.geometry.coordinates[r]],{parent:-1,winding:ri(t.geometry.coordinates[r])}));var l=k(u);return q(),G(),l}var h=[],c=[];for(r=0;r<e;r++){h.push([]);for(var f=0;f<t.geometry.coordinates[r].length-1;f++)h[r].push([new ti(t.geometry.coordinates[r][oi(f+1,t.geometry.coordinates[r].length-1)],1,[r,f],[r,oi(f+1,t.geometry.coordinates[r].length-1)],void 0)]),c.push(new ei(t.geometry.coordinates[r][f],[r,oi(f-1,t.geometry.coordinates[r].length-1)],[r,f],void 0,void 0,!1,!0))}for(r=0;r<a;r++)h[s[r][1]][s[r][2]].push(new ti(s[r][0],s[r][5],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0)),s[r][11]&&c.push(new ei(s[r][0],[s[r][1],s[r][2]],[s[r][6],s[r][7]],void 0,void 0,!0,!0));var g=c.length;for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)h[r][f].sort((function(t,e){return t.param<e.param?-1:1}));var p=[];for(r=0;r<g;r++)p.push({minX:c[r].coord[0],minY:c[r].coord[1],maxX:c[r].coord[0],maxY:c[r].coord[1],index:r});var v=new Nt;v.load(p);for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)for(var d=0;d<h[r][f].length;d++){_=d==h[r][f].length-1?h[r][oi(f+1,t.geometry.coordinates[r].length-1)][0].coord:h[r][f][d+1].coord;var y=v.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0];h[r][f][d].nxtIsectAlongEdgeIn=y.index}for(r=0;r<h.length;r++)for(f=0;f<h[r].length;f++)for(d=0;d<h[r][f].length;d++){var _=h[r][f][d].coord,x=(y=v.search({minX:_[0],minY:_[1],maxX:_[0],maxY:_[1]})[0]).index;x<o?c[x].nxtIsectAlongRingAndEdge2=h[r][f][d].nxtIsectAlongEdgeIn:ii(c[x].ringAndEdge1,h[r][f][d].ringAndEdgeIn)?c[x].nxtIsectAlongRingAndEdge1=h[r][f][d].nxtIsectAlongEdgeIn:c[x].nxtIsectAlongRingAndEdge2=h[r][f][d].nxtIsectAlongEdgeIn}var E=[];for(r=0,f=0;f<e;f++){var w=r;for(d=0;d<t.geometry.coordinates[f].length-1;d++)c[r].coord[0]<c[w].coord[0]&&(w=r),r++;var b=c[w].nxtIsectAlongRingAndEdge2;for(d=0;d<c.length;d++)if(c[d].nxtIsectAlongRingAndEdge1==w||c[d].nxtIsectAlongRingAndEdge2==w){var I=d;break}var S=ni([c[I].coord,c[w].coord,c[b].coord],!0)?1:-1;E.push({isect:w,parent:-1,winding:S})}E.sort((function(t,e){return c[t.isect].coord>c[e.isect].coord?-1:1}));for(u=[];E.length>0;){var N=E.pop(),M=N.isect,P=N.parent,L=N.winding,C=u.length,R=[c[M].coord],T=M;if(c[M].ringAndEdge1Walkable)var O=c[M].ringAndEdge1,A=c[M].nxtIsectAlongRingAndEdge1;else O=c[M].ringAndEdge2,A=c[M].nxtIsectAlongRingAndEdge2;for(;!ii(c[M].coord,c[A].coord);){R.push(c[A].coord);var D=void 0;for(r=0;r<E.length;r++)if(E[r].isect==A){D=r;break}if(null!=D&&E.splice(D,1),ii(O,c[A].ringAndEdge1)){if(O=c[A].ringAndEdge2,c[A].ringAndEdge2Walkable=!1,c[A].ringAndEdge1Walkable){var F={isect:A};ni([c[T].coord,c[A].coord,c[c[A].nxtIsectAlongRingAndEdge2].coord],1==L)?(F.parent=P,F.winding=-L):(F.parent=C,F.winding=L),E.push(F)}T=A,A=c[A].nxtIsectAlongRingAndEdge2}else{if(O=c[A].ringAndEdge1,c[A].ringAndEdge1Walkable=!1,c[A].ringAndEdge2Walkable){F={isect:A};ni([c[T].coord,c[A].coord,c[c[A].nxtIsectAlongRingAndEdge1].coord],1==L)?(F.parent=P,F.winding=-L):(F.parent=C,F.winding=L),E.push(F)}T=A,A=c[A].nxtIsectAlongRingAndEdge1}}R.push(c[A].coord),u.push(m([R],{index:C,parent:P,winding:L,netWinding:void 0}))}l=k(u);function q(){for(var t=[],e=0;e<l.features.length;e++)-1==l.features[e].properties.parent&&t.push(e);if(t.length>1)for(e=0;e<t.length;e++){for(var n=-1,r=0;r<l.features.length;r++)t[e]!=r&&ye(l.features[t[e]].geometry.coordinates[0][0],l.features[r],{ignoreBoundary:!0})&&Ar(l.features[r])<Infinity&&(n=r);l.features[t[e]].properties.parent=n}}function G(){for(var t=0;t<l.features.length;t++)if(-1==l.features[t].properties.parent){var e=l.features[t].properties.winding;l.features[t].properties.netWinding=e,Y(t,e)}}function Y(t,e){for(var n=0;n<l.features.length;n++)if(l.features[n].properties.parent==t){var r=e+l.features[n].properties.winding;l.features[n].properties.netWinding=r,Y(n,r)}}return q(),G(),l}var ti=function(t,e,n,r,i){this.coord=t,this.param=e,this.ringAndEdgeIn=n,this.ringAndEdgeOut=r,this.nxtIsectAlongEdgeIn=i},ei=function(t,e,n,r,i,o,s){this.coord=t,this.ringAndEdge1=e,this.ringAndEdge2=n,this.nxtIsectAlongRingAndEdge1=r,this.nxtIsectAlongRingAndEdge2=i,this.ringAndEdge1Walkable=o,this.ringAndEdge2Walkable=s};function ni(t,e){if(void 0===e&&(e=!0),3!=t.length)throw new Error("This function requires an array of three points [x,y]");return(t[1][0]-t[0][0])*(t[2][1]-t[0][1])-(t[1][1]-t[0][1])*(t[2][0]-t[0][0])>=0==e}function ri(t){for(var e=0,n=0;n<t.length-1;n++)t[n][0]<t[e][0]&&(e=n);if(ni([t[oi(e-1,t.length-1)],t[e],t[oi(e+1,t.length-1)]],!0))var r=1;else r=-1;return r}function ii(t,e){if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!ii(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0}function oi(t,e){return(t%e+e)%e}
|
|
65
65
|
/*!
|
|
66
66
|
* Copyright (c) 2019, Dane Springmeyer
|
|
67
67
|
*
|