@turf/helpers 7.0.0 → 7.1.0-alpha.70
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/README.md +149 -146
- package/dist/cjs/index.cjs +8 -158
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +13 -34
- package/dist/esm/index.d.ts +13 -34
- package/dist/esm/index.js +7 -157
- package/dist/esm/index.js.map +1 -1
- package/package.json +3 -4
package/README.md
CHANGED
|
@@ -6,36 +6,36 @@
|
|
|
6
6
|
|
|
7
7
|
### earthRadius
|
|
8
8
|
|
|
9
|
-
Earth
|
|
9
|
+
The Earth radius in kilometers. Used by Turf modules that model the Earth as a sphere. The [mean radius][1] was selected because it is [recommended ][2] by the Haversine formula (used by turf/distance) to reduce error.
|
|
10
10
|
|
|
11
|
-
Type: [number][
|
|
11
|
+
Type: [number][3]
|
|
12
12
|
|
|
13
13
|
### factors
|
|
14
14
|
|
|
15
|
-
Unit of measurement factors
|
|
15
|
+
Unit of measurement factors based on earthRadius.
|
|
16
16
|
|
|
17
17
|
Keys are the name of the unit, values are the number of that unit in a single radian
|
|
18
18
|
|
|
19
|
-
Type: [Object][
|
|
19
|
+
Type: [Object][4]
|
|
20
20
|
|
|
21
21
|
### areaFactors
|
|
22
22
|
|
|
23
23
|
Area of measurement factors based on 1 square meter.
|
|
24
24
|
|
|
25
|
-
Type: [Object][
|
|
25
|
+
Type: [Object][4]
|
|
26
26
|
|
|
27
27
|
## feature
|
|
28
28
|
|
|
29
|
-
Wraps a GeoJSON [Geometry][
|
|
29
|
+
Wraps a GeoJSON [Geometry][5] in a GeoJSON [Feature][6].
|
|
30
30
|
|
|
31
31
|
### Parameters
|
|
32
32
|
|
|
33
33
|
* `geometry` **[Geometry][5]** input geometry
|
|
34
|
-
* `properties` **[Object][
|
|
35
|
-
* `options` **[Object][
|
|
34
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
35
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
36
36
|
|
|
37
|
-
* `options.bbox` **[Array][
|
|
38
|
-
* `options.id` **([string][
|
|
37
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
38
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
39
39
|
|
|
40
40
|
### Examples
|
|
41
41
|
|
|
@@ -50,18 +50,18 @@ var feature = turf.feature(geometry);
|
|
|
50
50
|
//=feature
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
Returns **[Feature][
|
|
53
|
+
Returns **[Feature][6]** a GeoJSON Feature
|
|
54
54
|
|
|
55
55
|
## geometry
|
|
56
56
|
|
|
57
|
-
Creates a GeoJSON [Geometry][
|
|
57
|
+
Creates a GeoJSON [Geometry][5] from a Geometry string type & coordinates.
|
|
58
58
|
For GeometryCollection type use `helpers.geometryCollection`
|
|
59
59
|
|
|
60
60
|
### Parameters
|
|
61
61
|
|
|
62
|
-
* `type` **[string][
|
|
63
|
-
* `coordinates` **[Array][
|
|
64
|
-
* `options` **[Object][
|
|
62
|
+
* `type` **[string][8]** Geometry Type
|
|
63
|
+
* `coordinates` **[Array][7]\<any>** Coordinates
|
|
64
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
65
65
|
|
|
66
66
|
### Examples
|
|
67
67
|
|
|
@@ -76,16 +76,16 @@ Returns **[Geometry][5]** a GeoJSON Geometry
|
|
|
76
76
|
|
|
77
77
|
## point
|
|
78
78
|
|
|
79
|
-
Creates a [Point][9] [Feature][
|
|
79
|
+
Creates a [Point][9] [Feature][6] from a Position.
|
|
80
80
|
|
|
81
81
|
### Parameters
|
|
82
82
|
|
|
83
|
-
* `coordinates` **[Array][
|
|
84
|
-
* `properties` **[Object][
|
|
85
|
-
* `options` **[Object][
|
|
83
|
+
* `coordinates` **[Array][7]<[number][3]>** longitude, latitude position (each in decimal degrees)
|
|
84
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
85
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
86
86
|
|
|
87
|
-
* `options.bbox` **[Array][
|
|
88
|
-
* `options.id` **([string][
|
|
87
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
88
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
89
89
|
|
|
90
90
|
### Examples
|
|
91
91
|
|
|
@@ -95,21 +95,21 @@ var point = turf.point([-75.343, 39.984]);
|
|
|
95
95
|
//=point
|
|
96
96
|
```
|
|
97
97
|
|
|
98
|
-
Returns **[Feature][
|
|
98
|
+
Returns **[Feature][6]<[Point][9]>** a Point feature
|
|
99
99
|
|
|
100
100
|
## points
|
|
101
101
|
|
|
102
|
-
Creates a [Point][9] [FeatureCollection][
|
|
102
|
+
Creates a [Point][9] [FeatureCollection][10] from an Array of Point coordinates.
|
|
103
103
|
|
|
104
104
|
### Parameters
|
|
105
105
|
|
|
106
|
-
* `coordinates` **[Array][
|
|
107
|
-
* `properties` **[Object][
|
|
108
|
-
* `options` **[Object][
|
|
106
|
+
* `coordinates` **[Array][7]<[Array][7]<[number][3]>>** an array of Points
|
|
107
|
+
* `properties` **[Object][4]** Translate these properties to each Feature (optional, default `{}`)
|
|
108
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
109
109
|
|
|
110
|
-
* `options.bbox` **[Array][
|
|
110
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north]
|
|
111
111
|
associated with the FeatureCollection
|
|
112
|
-
* `options.id` **([string][
|
|
112
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the FeatureCollection
|
|
113
113
|
|
|
114
114
|
### Examples
|
|
115
115
|
|
|
@@ -123,20 +123,20 @@ var points = turf.points([
|
|
|
123
123
|
//=points
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
-
Returns **[FeatureCollection][
|
|
126
|
+
Returns **[FeatureCollection][10]<[Point][9]>** Point Feature
|
|
127
127
|
|
|
128
128
|
## polygon
|
|
129
129
|
|
|
130
|
-
Creates a [Polygon][
|
|
130
|
+
Creates a [Polygon][11] [Feature][6] from an Array of LinearRings.
|
|
131
131
|
|
|
132
132
|
### Parameters
|
|
133
133
|
|
|
134
|
-
* `coordinates` **[Array][
|
|
135
|
-
* `properties` **[Object][
|
|
136
|
-
* `options` **[Object][
|
|
134
|
+
* `coordinates` **[Array][7]<[Array][7]<[Array][7]<[number][3]>>>** an array of LinearRings
|
|
135
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
136
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
137
137
|
|
|
138
|
-
* `options.bbox` **[Array][
|
|
139
|
-
* `options.id` **([string][
|
|
138
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
139
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
140
140
|
|
|
141
141
|
### Examples
|
|
142
142
|
|
|
@@ -146,20 +146,20 @@ var polygon = turf.polygon([[[-5, 52], [-4, 56], [-2, 51], [-7, 54], [-5, 52]]],
|
|
|
146
146
|
//=polygon
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
-
Returns **[Feature][
|
|
149
|
+
Returns **[Feature][6]<[Polygon][11]>** Polygon Feature
|
|
150
150
|
|
|
151
151
|
## polygons
|
|
152
152
|
|
|
153
|
-
Creates a [Polygon][
|
|
153
|
+
Creates a [Polygon][11] [FeatureCollection][10] from an Array of Polygon coordinates.
|
|
154
154
|
|
|
155
155
|
### Parameters
|
|
156
156
|
|
|
157
|
-
* `coordinates` **[Array][
|
|
158
|
-
* `properties` **[Object][
|
|
159
|
-
* `options` **[Object][
|
|
157
|
+
* `coordinates` **[Array][7]<[Array][7]<[Array][7]<[Array][7]<[number][3]>>>>** an array of Polygon coordinates
|
|
158
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
159
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
160
160
|
|
|
161
|
-
* `options.bbox` **[Array][
|
|
162
|
-
* `options.id` **([string][
|
|
161
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
162
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the FeatureCollection
|
|
163
163
|
|
|
164
164
|
### Examples
|
|
165
165
|
|
|
@@ -172,20 +172,20 @@ var polygons = turf.polygons([
|
|
|
172
172
|
//=polygons
|
|
173
173
|
```
|
|
174
174
|
|
|
175
|
-
Returns **[FeatureCollection][
|
|
175
|
+
Returns **[FeatureCollection][10]<[Polygon][11]>** Polygon FeatureCollection
|
|
176
176
|
|
|
177
177
|
## lineString
|
|
178
178
|
|
|
179
|
-
Creates a [LineString][
|
|
179
|
+
Creates a [LineString][12] [Feature][6] from an Array of Positions.
|
|
180
180
|
|
|
181
181
|
### Parameters
|
|
182
182
|
|
|
183
|
-
* `coordinates` **[Array][
|
|
184
|
-
* `properties` **[Object][
|
|
185
|
-
* `options` **[Object][
|
|
183
|
+
* `coordinates` **[Array][7]<[Array][7]<[number][3]>>** an array of Positions
|
|
184
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
185
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
186
186
|
|
|
187
|
-
* `options.bbox` **[Array][
|
|
188
|
-
* `options.id` **([string][
|
|
187
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
188
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
189
189
|
|
|
190
190
|
### Examples
|
|
191
191
|
|
|
@@ -197,21 +197,21 @@ var linestring2 = turf.lineString([[-14, 43], [-13, 40], [-15, 45], [-10, 49]],
|
|
|
197
197
|
//=linestring2
|
|
198
198
|
```
|
|
199
199
|
|
|
200
|
-
Returns **[Feature][
|
|
200
|
+
Returns **[Feature][6]<[LineString][12]>** LineString Feature
|
|
201
201
|
|
|
202
202
|
## lineStrings
|
|
203
203
|
|
|
204
|
-
Creates a [LineString][
|
|
204
|
+
Creates a [LineString][12] [FeatureCollection][10] from an Array of LineString coordinates.
|
|
205
205
|
|
|
206
206
|
### Parameters
|
|
207
207
|
|
|
208
|
-
* `coordinates` **[Array][
|
|
209
|
-
* `properties` **[Object][
|
|
210
|
-
* `options` **[Object][
|
|
208
|
+
* `coordinates` **[Array][7]<[Array][7]<[Array][7]<[number][3]>>>** an array of LinearRings
|
|
209
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
210
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
211
211
|
|
|
212
|
-
* `options.bbox` **[Array][
|
|
212
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north]
|
|
213
213
|
associated with the FeatureCollection
|
|
214
|
-
* `options.id` **([string][
|
|
214
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the FeatureCollection
|
|
215
215
|
|
|
216
216
|
### Examples
|
|
217
217
|
|
|
@@ -224,19 +224,19 @@ var linestrings = turf.lineStrings([
|
|
|
224
224
|
//=linestrings
|
|
225
225
|
```
|
|
226
226
|
|
|
227
|
-
Returns **[FeatureCollection][
|
|
227
|
+
Returns **[FeatureCollection][10]<[LineString][12]>** LineString FeatureCollection
|
|
228
228
|
|
|
229
229
|
## featureCollection
|
|
230
230
|
|
|
231
|
-
Takes one or more [Features][
|
|
231
|
+
Takes one or more [Features][6] and creates a [FeatureCollection][10].
|
|
232
232
|
|
|
233
233
|
### Parameters
|
|
234
234
|
|
|
235
|
-
* `features` **[Array][
|
|
236
|
-
* `options` **[Object][
|
|
235
|
+
* `features` **[Array][7]<[Feature][6]>** input features
|
|
236
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
237
237
|
|
|
238
|
-
* `options.bbox` **[Array][
|
|
239
|
-
* `options.id` **([string][
|
|
238
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
239
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
240
240
|
|
|
241
241
|
### Examples
|
|
242
242
|
|
|
@@ -254,21 +254,21 @@ var collection = turf.featureCollection([
|
|
|
254
254
|
//=collection
|
|
255
255
|
```
|
|
256
256
|
|
|
257
|
-
Returns **[FeatureCollection][
|
|
257
|
+
Returns **[FeatureCollection][10]** FeatureCollection of Features
|
|
258
258
|
|
|
259
259
|
## multiLineString
|
|
260
260
|
|
|
261
|
-
Creates a [Feature\<MultiLineString>][
|
|
261
|
+
Creates a [Feature\<MultiLineString>][13] based on a
|
|
262
262
|
coordinate array. Properties can be added optionally.
|
|
263
263
|
|
|
264
264
|
### Parameters
|
|
265
265
|
|
|
266
|
-
* `coordinates` **[Array][
|
|
267
|
-
* `properties` **[Object][
|
|
268
|
-
* `options` **[Object][
|
|
266
|
+
* `coordinates` **[Array][7]<[Array][7]<[Array][7]<[number][3]>>>** an array of LineStrings
|
|
267
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
268
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
269
269
|
|
|
270
|
-
* `options.bbox` **[Array][
|
|
271
|
-
* `options.id` **([string][
|
|
270
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
271
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
272
272
|
|
|
273
273
|
### Examples
|
|
274
274
|
|
|
@@ -278,23 +278,23 @@ var multiLine = turf.multiLineString([[[0,0],[10,10]]]);
|
|
|
278
278
|
//=multiLine
|
|
279
279
|
```
|
|
280
280
|
|
|
281
|
-
* Throws **[Error][
|
|
281
|
+
* Throws **[Error][14]** if no coordinates are passed
|
|
282
282
|
|
|
283
|
-
Returns **[Feature][
|
|
283
|
+
Returns **[Feature][6]<[MultiLineString][15]>** a MultiLineString feature
|
|
284
284
|
|
|
285
285
|
## multiPoint
|
|
286
286
|
|
|
287
|
-
Creates a [Feature\<MultiPoint>][
|
|
287
|
+
Creates a [Feature\<MultiPoint>][16] based on a
|
|
288
288
|
coordinate array. Properties can be added optionally.
|
|
289
289
|
|
|
290
290
|
### Parameters
|
|
291
291
|
|
|
292
|
-
* `coordinates` **[Array][
|
|
293
|
-
* `properties` **[Object][
|
|
294
|
-
* `options` **[Object][
|
|
292
|
+
* `coordinates` **[Array][7]<[Array][7]<[number][3]>>** an array of Positions
|
|
293
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
294
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
295
295
|
|
|
296
|
-
* `options.bbox` **[Array][
|
|
297
|
-
* `options.id` **([string][
|
|
296
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
297
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
298
298
|
|
|
299
299
|
### Examples
|
|
300
300
|
|
|
@@ -304,23 +304,23 @@ var multiPt = turf.multiPoint([[0,0],[10,10]]);
|
|
|
304
304
|
//=multiPt
|
|
305
305
|
```
|
|
306
306
|
|
|
307
|
-
* Throws **[Error][
|
|
307
|
+
* Throws **[Error][14]** if no coordinates are passed
|
|
308
308
|
|
|
309
|
-
Returns **[Feature][
|
|
309
|
+
Returns **[Feature][6]<[MultiPoint][17]>** a MultiPoint feature
|
|
310
310
|
|
|
311
311
|
## multiPolygon
|
|
312
312
|
|
|
313
|
-
Creates a [Feature\<MultiPolygon>][
|
|
313
|
+
Creates a [Feature\<MultiPolygon>][18] based on a
|
|
314
314
|
coordinate array. Properties can be added optionally.
|
|
315
315
|
|
|
316
316
|
### Parameters
|
|
317
317
|
|
|
318
|
-
* `coordinates` **[Array][
|
|
319
|
-
* `properties` **[Object][
|
|
320
|
-
* `options` **[Object][
|
|
318
|
+
* `coordinates` **[Array][7]<[Array][7]<[Array][7]<[Array][7]<[number][3]>>>>** an array of Polygons
|
|
319
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
320
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
321
321
|
|
|
322
|
-
* `options.bbox` **[Array][
|
|
323
|
-
* `options.id` **([string][
|
|
322
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
323
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
324
324
|
|
|
325
325
|
### Examples
|
|
326
326
|
|
|
@@ -330,23 +330,23 @@ var multiPoly = turf.multiPolygon([[[[0,0],[0,10],[10,10],[10,0],[0,0]]]]);
|
|
|
330
330
|
//=multiPoly
|
|
331
331
|
```
|
|
332
332
|
|
|
333
|
-
* Throws **[Error][
|
|
333
|
+
* Throws **[Error][14]** if no coordinates are passed
|
|
334
334
|
|
|
335
|
-
Returns **[Feature][
|
|
335
|
+
Returns **[Feature][6]<[MultiPolygon][19]>** a multipolygon feature
|
|
336
336
|
|
|
337
337
|
## geometryCollection
|
|
338
338
|
|
|
339
|
-
Creates a [Feature\<GeometryCollection>][
|
|
339
|
+
Creates a [Feature\<GeometryCollection>][20] based on a
|
|
340
340
|
coordinate array. Properties can be added optionally.
|
|
341
341
|
|
|
342
342
|
### Parameters
|
|
343
343
|
|
|
344
|
-
* `geometries` **[Array][
|
|
345
|
-
* `properties` **[Object][
|
|
346
|
-
* `options` **[Object][
|
|
344
|
+
* `geometries` **[Array][7]<[Geometry][5]>** an array of GeoJSON Geometries
|
|
345
|
+
* `properties` **[Object][4]** an Object of key-value pairs to add as properties (optional, default `{}`)
|
|
346
|
+
* `options` **[Object][4]** Optional Parameters (optional, default `{}`)
|
|
347
347
|
|
|
348
|
-
* `options.bbox` **[Array][
|
|
349
|
-
* `options.id` **([string][
|
|
348
|
+
* `options.bbox` **[Array][7]<[number][3]>?** Bounding Box Array \[west, south, east, north] associated with the Feature
|
|
349
|
+
* `options.id` **([string][8] | [number][3])?** Identifier associated with the Feature
|
|
350
350
|
|
|
351
351
|
### Examples
|
|
352
352
|
|
|
@@ -358,7 +358,7 @@ var collection = turf.geometryCollection([pt, line]);
|
|
|
358
358
|
// => collection
|
|
359
359
|
```
|
|
360
360
|
|
|
361
|
-
Returns **[Feature][
|
|
361
|
+
Returns **[Feature][6]<[GeometryCollection][21]>** a GeoJSON GeometryCollection Feature
|
|
362
362
|
|
|
363
363
|
## round
|
|
364
364
|
|
|
@@ -366,8 +366,8 @@ Round number to precision
|
|
|
366
366
|
|
|
367
367
|
### Parameters
|
|
368
368
|
|
|
369
|
-
* `num` **[number][
|
|
370
|
-
* `precision` **[number][
|
|
369
|
+
* `num` **[number][3]** Number
|
|
370
|
+
* `precision` **[number][3]** Precision (optional, default `0`)
|
|
371
371
|
|
|
372
372
|
### Examples
|
|
373
373
|
|
|
@@ -379,7 +379,7 @@ turf.round(120.4321, 2)
|
|
|
379
379
|
//=120.43
|
|
380
380
|
```
|
|
381
381
|
|
|
382
|
-
Returns **[number][
|
|
382
|
+
Returns **[number][3]** rounded number
|
|
383
383
|
|
|
384
384
|
## radiansToLength
|
|
385
385
|
|
|
@@ -388,11 +388,11 @@ Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, ce
|
|
|
388
388
|
|
|
389
389
|
### Parameters
|
|
390
390
|
|
|
391
|
-
* `radians` **[number][
|
|
392
|
-
* `units` **[string][
|
|
391
|
+
* `radians` **[number][3]** in radians across the sphere
|
|
392
|
+
* `units` **[string][8]** can be degrees, radians, miles, inches, yards, metres,
|
|
393
393
|
meters, kilometres, kilometers. (optional, default `"kilometers"`)
|
|
394
394
|
|
|
395
|
-
Returns **[number][
|
|
395
|
+
Returns **[number][3]** distance
|
|
396
396
|
|
|
397
397
|
## lengthToRadians
|
|
398
398
|
|
|
@@ -401,11 +401,11 @@ Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, ce
|
|
|
401
401
|
|
|
402
402
|
### Parameters
|
|
403
403
|
|
|
404
|
-
* `distance` **[number][
|
|
405
|
-
* `units` **[string][
|
|
404
|
+
* `distance` **[number][3]** in real units
|
|
405
|
+
* `units` **[string][8]** can be degrees, radians, miles, inches, yards, metres,
|
|
406
406
|
meters, kilometres, kilometers. (optional, default `"kilometers"`)
|
|
407
407
|
|
|
408
|
-
Returns **[number][
|
|
408
|
+
Returns **[number][3]** radians
|
|
409
409
|
|
|
410
410
|
## lengthToDegrees
|
|
411
411
|
|
|
@@ -414,11 +414,11 @@ Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, k
|
|
|
414
414
|
|
|
415
415
|
### Parameters
|
|
416
416
|
|
|
417
|
-
* `distance` **[number][
|
|
418
|
-
* `units` **[string][
|
|
417
|
+
* `distance` **[number][3]** in real units
|
|
418
|
+
* `units` **[string][8]** can be degrees, radians, miles, inches, yards, metres,
|
|
419
419
|
meters, kilometres, kilometers. (optional, default `"kilometers"`)
|
|
420
420
|
|
|
421
|
-
Returns **[number][
|
|
421
|
+
Returns **[number][3]** degrees
|
|
422
422
|
|
|
423
423
|
## bearingToAzimuth
|
|
424
424
|
|
|
@@ -427,9 +427,20 @@ and returns an angle between 0-360 degrees (positive clockwise), 0 being the nor
|
|
|
427
427
|
|
|
428
428
|
### Parameters
|
|
429
429
|
|
|
430
|
-
* `bearing` **[number][
|
|
430
|
+
* `bearing` **[number][3]** angle, between -180 and +180 degrees
|
|
431
431
|
|
|
432
|
-
Returns **[number][
|
|
432
|
+
Returns **[number][3]** angle between 0 and 360 degrees
|
|
433
|
+
|
|
434
|
+
## azimuthToBearing
|
|
435
|
+
|
|
436
|
+
Converts any azimuth angle from the north line direction (positive clockwise)
|
|
437
|
+
and returns an angle between -180 and +180 degrees (positive clockwise), 0 being the north line
|
|
438
|
+
|
|
439
|
+
### Parameters
|
|
440
|
+
|
|
441
|
+
* `angle` **[number][3]** between 0 and 360 degrees
|
|
442
|
+
|
|
443
|
+
Returns **[number][3]** bearing between -180 and +180 degrees
|
|
433
444
|
|
|
434
445
|
## radiansToDegrees
|
|
435
446
|
|
|
@@ -437,9 +448,9 @@ Converts an angle in radians to degrees
|
|
|
437
448
|
|
|
438
449
|
### Parameters
|
|
439
450
|
|
|
440
|
-
* `radians` **[number][
|
|
451
|
+
* `radians` **[number][3]** angle in radians
|
|
441
452
|
|
|
442
|
-
Returns **[number][
|
|
453
|
+
Returns **[number][3]** degrees between 0 and 360 degrees
|
|
443
454
|
|
|
444
455
|
## degreesToRadians
|
|
445
456
|
|
|
@@ -447,9 +458,9 @@ Converts an angle in degrees to radians
|
|
|
447
458
|
|
|
448
459
|
### Parameters
|
|
449
460
|
|
|
450
|
-
* `degrees` **[number][
|
|
461
|
+
* `degrees` **[number][3]** angle between 0 and 360 degrees
|
|
451
462
|
|
|
452
|
-
Returns **[number][
|
|
463
|
+
Returns **[number][3]** angle in radians
|
|
453
464
|
|
|
454
465
|
## convertLength
|
|
455
466
|
|
|
@@ -458,11 +469,11 @@ Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, ce
|
|
|
458
469
|
|
|
459
470
|
### Parameters
|
|
460
471
|
|
|
461
|
-
* `length` **[number][
|
|
472
|
+
* `length` **[number][3]** to be converted
|
|
462
473
|
* `originalUnit` **Units** of the length (optional, default `"kilometers"`)
|
|
463
474
|
* `finalUnit` **Units** returned unit (optional, default `"kilometers"`)
|
|
464
475
|
|
|
465
|
-
Returns **[number][
|
|
476
|
+
Returns **[number][3]** the converted length
|
|
466
477
|
|
|
467
478
|
## convertArea
|
|
468
479
|
|
|
@@ -471,11 +482,11 @@ Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, a
|
|
|
471
482
|
|
|
472
483
|
### Parameters
|
|
473
484
|
|
|
474
|
-
* `area` **[number][
|
|
485
|
+
* `area` **[number][3]** to be converted
|
|
475
486
|
* `originalUnit` **Units** of the distance (optional, default `"meters"`)
|
|
476
487
|
* `finalUnit` **Units** returned unit (optional, default `"kilometers"`)
|
|
477
488
|
|
|
478
|
-
Returns **[number][
|
|
489
|
+
Returns **[number][3]** the converted area
|
|
479
490
|
|
|
480
491
|
## isNumber
|
|
481
492
|
|
|
@@ -494,7 +505,7 @@ turf.isNumber('foo')
|
|
|
494
505
|
//=false
|
|
495
506
|
```
|
|
496
507
|
|
|
497
|
-
Returns **[boolean][
|
|
508
|
+
Returns **[boolean][22]** true/false
|
|
498
509
|
|
|
499
510
|
## isObject
|
|
500
511
|
|
|
@@ -513,59 +524,51 @@ turf.isObject('foo')
|
|
|
513
524
|
//=false
|
|
514
525
|
```
|
|
515
526
|
|
|
516
|
-
Returns **[boolean][
|
|
527
|
+
Returns **[boolean][22]** true/false, including false for Arrays and Functions
|
|
517
528
|
|
|
518
|
-
[1]: https://
|
|
529
|
+
[1]: https://en.wikipedia.org/wiki/Earth_radius#Arithmetic_mean_radius
|
|
519
530
|
|
|
520
|
-
[2]: https://
|
|
531
|
+
[2]: https://rosettacode.org/wiki/Haversine_formula#:~:text=This%20value%20is%20recommended
|
|
521
532
|
|
|
522
|
-
[3]: https://
|
|
533
|
+
[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
|
|
523
534
|
|
|
524
|
-
[4]: https://
|
|
535
|
+
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object
|
|
525
536
|
|
|
526
537
|
[5]: https://tools.ietf.org/html/rfc7946#section-3.1
|
|
527
538
|
|
|
528
|
-
[6]: https://
|
|
539
|
+
[6]: https://tools.ietf.org/html/rfc7946#section-3.2
|
|
529
540
|
|
|
530
|
-
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/
|
|
541
|
+
[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
|
|
531
542
|
|
|
532
|
-
[8]: https://
|
|
543
|
+
[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
|
|
533
544
|
|
|
534
545
|
[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2
|
|
535
546
|
|
|
536
|
-
[10]: https://tools.ietf.org/html/rfc7946#section-3.
|
|
537
|
-
|
|
538
|
-
[11]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
539
|
-
|
|
540
|
-
[12]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
541
|
-
|
|
542
|
-
[13]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
543
|
-
|
|
544
|
-
[14]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
547
|
+
[10]: https://tools.ietf.org/html/rfc7946#section-3.3
|
|
545
548
|
|
|
546
|
-
[
|
|
549
|
+
[11]: https://tools.ietf.org/html/rfc7946#section-3.1.6
|
|
547
550
|
|
|
548
|
-
[
|
|
551
|
+
[12]: https://tools.ietf.org/html/rfc7946#section-3.1.4
|
|
549
552
|
|
|
550
|
-
[
|
|
553
|
+
[13]: Feature<MultiLineString>
|
|
551
554
|
|
|
552
|
-
[
|
|
555
|
+
[14]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error
|
|
553
556
|
|
|
554
|
-
[
|
|
557
|
+
[15]: https://tools.ietf.org/html/rfc7946#section-3.1.5
|
|
555
558
|
|
|
556
|
-
[
|
|
559
|
+
[16]: Feature<MultiPoint>
|
|
557
560
|
|
|
558
|
-
[
|
|
561
|
+
[17]: https://tools.ietf.org/html/rfc7946#section-3.1.3
|
|
559
562
|
|
|
560
|
-
[
|
|
563
|
+
[18]: Feature<MultiPolygon>
|
|
561
564
|
|
|
562
|
-
[
|
|
565
|
+
[19]: https://tools.ietf.org/html/rfc7946#section-3.1.7
|
|
563
566
|
|
|
564
|
-
[
|
|
567
|
+
[20]: Feature<GeometryCollection>
|
|
565
568
|
|
|
566
|
-
[
|
|
569
|
+
[21]: https://tools.ietf.org/html/rfc7946#section-3.1.8
|
|
567
570
|
|
|
568
|
-
[
|
|
571
|
+
[22]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
|
|
569
572
|
|
|
570
573
|
<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->
|
|
571
574
|
|