open-index/open-npm huggingface dataset:
npm package: @spatial/clusters-dbscan
Description: turf clusters-dbscan module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/clusters-dbscan

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## clustersDbscan

Takes a set of [points][1] and partition them into clusters according to [https://en.wikipedia.org/wiki/DBSCAN][2] data clustering algorithm.

### Parameters

-   `points` **[FeatureCollection][3]&lt;[Point][4]>** to be clustered
-   `maxDistance` **[number][5]** Maximum Distance between any point of the cluster to generate the clusters (kilometers only)
-   `options` **[Object][6]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][7]** in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
    -   `options.minPoints` **[number][5]** Minimum number of points to generate a single cluster,
        points which do not meet this requirement will be classified as an 'edge' or 'noise'. (optional, default `3`)

### Examples

```javascript
// create random points with random z-values in their properties
var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
var maxDistance = 100;
var clustered = turf.clustersDbscan(points, maxDistance);

//addToMap
var addToMap = [clustered];
```

Returns **[FeatureCollection][3]&lt;[Point][4]>** Clustered Points with an additional two properties associated to each Feature:-   {number} cluster - the associated clusterId
-   {string} dbscan - type of point it has been classified as ('core'|'edge'|'noise')

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: DBSCAN's

[3]: https://tools.ietf.org/html/rfc7946#section-3.3

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/clusters-dbscan
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/clusters-kmeans
Description: turf clusters-kmeans module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/clusters-kmeans

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## clustersKmeans

Takes a set of [points][1] and partition them into clusters using the k-mean .
It uses the [k-means algorithm][2]

### Parameters

-   `points` **[FeatureCollection][3]&lt;[Point][4]>** to be clustered
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.numberOfClusters` **[number][6]** numberOfClusters that will be generated (optional, default `Math.sqrt(numberOfPoints/2)`)
    -   `options.mutate` **[boolean][7]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

### Examples

```javascript
// create random points with random z-values in their properties
var points = turf.randomPoint(100, {bbox: [0, 30, 20, 50]});
var options = {numberOfClusters: 7};
var clustered = turf.clustersKmeans(points, options);

//addToMap
var addToMap = [clustered];
```

Returns **[FeatureCollection][3]&lt;[Point][4]>** Clustered Points with an additional two properties associated to each Feature:-   {number} cluster - the associated clusterId
-   {[number, number]} centroid - Centroid of the cluster [Longitude, Latitude]

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: https://en.wikipedia.org/wiki/K-means_clustering

[3]: https://tools.ietf.org/html/rfc7946#section-3.3

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/clusters-kmeans
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/collect
Description: turf collect module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/collect

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## collect

Merges a specified property from a FeatureCollection of points into a
FeatureCollection of polygons. Given an `inProperty` on points and an `outProperty`
for polygons, this finds every point that lies within each polygon, collects the
`inProperty` values from those points, and adds them as an array to `outProperty`
on the polygon.

### Parameters

-   `polygons` **[FeatureCollection][1]&lt;[Polygon][2]>** polygons with values on which to aggregate
-   `points` **[FeatureCollection][1]&lt;[Point][3]>** points to be aggregated
-   `inProperty` **[string][4]** property to be nested from
-   `outProperty` **[string][4]** property to be nested into

### Examples

```javascript
var poly1 = turf.polygon([[[0,0],[10,0],[10,10],[0,10],[0,0]]]);
var poly2 = turf.polygon([[[10,0],[20,10],[20,20],[20,0],[10,0]]]);
var polyFC = turf.featureCollection([poly1, poly2]);
var pt1 = turf.point([5,5], {population: 200});
var pt2 = turf.point([1,3], {population: 600});
var pt3 = turf.point([14,2], {population: 100});
var pt4 = turf.point([13,1], {population: 200});
var pt5 = turf.point([19,7], {population: 300});
var pointFC = turf.featureCollection([pt1, pt2, pt3, pt4, pt5]);
var collected = turf.collect(polyFC, pointFC, 'population', 'values');
var values = collected.features[0].properties.values
//=values => [200, 600]

//addToMap
var addToMap = [pointFC, collected]
```

Returns **[FeatureCollection][1]&lt;[Polygon][2]>** polygons with properties listed based on `outField`

[1]: https://tools.ietf.org/html/rfc7946#section-3.3

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/collect
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/combine
Description: turf combine module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/combine

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## combine

Combines a [FeatureCollection][1] of [Point][2], [LineString][3], or [Polygon][4] features
into [MultiPoint][5], [MultiLineString][6], or [MultiPolygon][7] features.

### Parameters

-   `fc` **[FeatureCollection][8]&lt;([Point][9] \| [LineString][10] \| [Polygon][11])>** a FeatureCollection of any type

### Examples

```javascript
var fc = turf.featureCollection([
  turf.point([19.026432, 47.49134]),
  turf.point([19.074497, 47.509548])
]);

var combined = turf.combine(fc);

//addToMap
var addToMap = [combined]
```

Returns **[FeatureCollection][8]&lt;([MultiPoint][12] \| [MultiLineString][13] \| [MultiPolygon][14])>** a FeatureCollection of corresponding type to input

[1]: https://tools.ietf.org/html/rfc7946#section-3.3

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.4

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[5]: https://tools.ietf.org/html/rfc7946#section-3.1.3

[6]: https://tools.ietf.org/html/rfc7946#section-3.1.5

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.7

[8]: https://tools.ietf.org/html/rfc7946#section-3.3

[9]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[10]: https://tools.ietf.org/html/rfc7946#section-3.1.4

[11]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[12]: https://tools.ietf.org/html/rfc7946#section-3.1.3

[13]: https://tools.ietf.org/html/rfc7946#section-3.1.5

[14]: https://tools.ietf.org/html/rfc7946#section-3.1.7

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/combine
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/concave
Description: turf concave module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/concave

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## concave

Takes a set of [points][1] and returns a concave hull Polygon or MultiPolygon.
Internally, this uses [turf-tin][2] to generate geometries.

### Parameters

-   `points` **[FeatureCollection][3]&lt;[Point][4]>** input points
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.maxEdge` **[number][6]** the length (in 'units') of an edge necessary for part of the hull to become concave. (optional, default `Infinity`)
    -   `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)

### Examples

```javascript
var points = turf.featureCollection([
  turf.point([-63.601226, 44.642643]),
  turf.point([-63.591442, 44.651436]),
  turf.point([-63.580799, 44.648749]),
  turf.point([-63.573589, 44.641788]),
  turf.point([-63.587665, 44.64533]),
  turf.point([-63.595218, 44.64765])
]);
var options = {units: 'miles', maxEdge: 1};

var hull = turf.concave(points, options);

//addToMap
var addToMap = [points, hull]
```

Returns **([Feature][8]&lt;([Polygon][9] \| [MultiPolygon][10])> | null)** a concave hull (null value is returned if unable to compute hull)

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: https://github.com/Turfjs/turf-tin

[3]: https://tools.ietf.org/html/rfc7946#section-3.3

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[8]: https://tools.ietf.org/html/rfc7946#section-3.2

[9]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[10]: https://tools.ietf.org/html/rfc7946#section-3.1.7

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/concave
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/convex
Description: turf convex module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/convex

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## convex

Takes a [Feature][1] or a [FeatureCollection][2] and returns a convex hull [Polygon][3].

Internally this uses
the [convex-hull][4] module that
implements a [monotone chain hull][5].

### Parameters

-   `geojson` **[GeoJSON][6]** input Feature or FeatureCollection
-   `options` **[Object][7]** Optional parameters (optional, default `{}`)
    -   `options.concavity` **[number][8]** 1 - thin shape. Infinity - convex hull. (optional, default `Infinity`)

### Examples

```javascript
var points = turf.featureCollection([
  turf.point([10.195312, 43.755225]),
  turf.point([10.404052, 43.8424511]),
  turf.point([10.579833, 43.659924]),
  turf.point([10.360107, 43.516688]),
  turf.point([10.14038, 43.588348]),
  turf.point([10.195312, 43.755225])
]);

var hull = turf.convex(points);

//addToMap
var addToMap = [points, hull]
```

Returns **[Feature][9]&lt;[Polygon][10]>** a convex hull

[1]: https://tools.ietf.org/html/rfc7946#section-3.2

[2]: https://tools.ietf.org/html/rfc7946#section-3.3

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[4]: https://github.com/mikolalysenko/convex-hull

[5]: http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain

[6]: https://tools.ietf.org/html/rfc7946#section-3

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[9]: https://tools.ietf.org/html/rfc7946#section-3.2

[10]: https://tools.ietf.org/html/rfc7946#section-3.1.6

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/convex
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/destination
Description: turf destination module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/destination

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## destination

Takes a [Point][1] and calculates the location of a destination point given a distance in degrees, radians, miles, or kilometers; and bearing in degrees. This uses the [Haversine formula][2] to account for global curvature.

### Parameters

-   `origin` **[Coord][3]** starting point
-   `distance` **[number][4]** distance from the origin point
-   `bearing` **[number][4]** ranging from -180 to 180
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][6]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
    -   `options.properties` **[Object][5]** Translate properties to Point (optional, default `{}`)

### Examples

```javascript
var point = turf.point([-75.343, 39.984]);
var distance = 50;
var bearing = 90;
var options = {units: 'miles'};

var destination = turf.destination(point, distance, bearing, options);

//addToMap
var addToMap = [point, destination]
destination.properties['marker-color'] = '#f00';
point.properties['marker-color'] = '#0f0';
```

Returns **[Feature][7]&lt;[Point][8]>** destination point

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: http://en.wikipedia.org/wiki/Haversine_formula

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.1

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[7]: https://tools.ietf.org/html/rfc7946#section-3.2

[8]: https://tools.ietf.org/html/rfc7946#section-3.1.2

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/destination
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/difference
Description: turf difference module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/difference

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## difference

Finds the difference between two [polygons][1] by clipping the second polygon from the first.

### Parameters

-   `polygon1` **[Feature][2]&lt;([Polygon][3] \| [MultiPolygon][4])>** input Polygon feature
-   `polygon2` **[Feature][2]&lt;([Polygon][3] \| [MultiPolygon][4])>** Polygon feature to difference from polygon1

### Examples

```javascript
var polygon1 = turf.polygon([[
  [128, -26],
  [141, -26],
  [141, -21],
  [128, -21],
  [128, -26]
]], {
  "fill": "#F00",
  "fill-opacity": 0.1
});
var polygon2 = turf.polygon([[
  [126, -28],
  [140, -28],
  [140, -20],
  [126, -20],
  [126, -28]
]], {
  "fill": "#00F",
  "fill-opacity": 0.1
});

var difference = turf.difference(polygon1, polygon2);

//addToMap
var addToMap = [polygon1, polygon2, difference];
```

Returns **([Feature][2]&lt;([Polygon][3] \| [MultiPolygon][4])> | null)** a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `null`)

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[2]: https://tools.ietf.org/html/rfc7946#section-3.2

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.7

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/difference
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/dissolve
Description: turf dissolve module
Author: Turf Authors
Latest version: 1.0.5

# @spatial/dissolve

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## dissolve

Dissolves a FeatureCollection of [polygon][1] features, filtered by an optional property name:value.
Note that [mulitpolygon][2] features within the collection are not supported

### Parameters

-   `featureCollection` **[FeatureCollection][3]&lt;[Polygon][4]>** input feature collection to be dissolved
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.propertyName` **[string][6]?** features with equals 'propertyName' in `properties` will be merged

### Examples

```javascript
var features = turf.featureCollection([
  turf.polygon([[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]], {combine: 'yes'}),
  turf.polygon([[[0, -1], [0, 0], [1, 0], [1, -1], [0,-1]]], {combine: 'yes'}),
  turf.polygon([[[1,-1],[1, 0], [2, 0], [2, -1], [1, -1]]], {combine: 'no'}),
]);

var dissolved = turf.dissolve(features, {propertyName: 'combine'});

//addToMap
var addToMap = [features, dissolved]
```

Returns **[FeatureCollection][3]&lt;[Polygon][4]>** a FeatureCollection containing the dissolved polygons

[1]: polygon

[2]: mulitpolygon

[3]: https://tools.ietf.org/html/rfc7946#section-3.3

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/dissolve
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/distance
Description: turf distance module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/distance

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## distance

Calculates the distance between two [points][1] in degrees, radians,
miles, or kilometers. This uses the
[Haversine formula][2]
to account for global curvature.

### Parameters

-   `from` **[Coord][3]** origin point
-   `to` **[Coord][3]** destination point
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][5]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)

### Examples

```javascript
var from = turf.point([-75.343, 39.984]);
var to = turf.point([-75.534, 39.123]);
var options = {units: 'miles'};

var distance = turf.distance(from, to, options);

//addToMap
var addToMap = [from, to];
from.properties.distance = distance;
to.properties.distance = distance;
```

Returns **[number][6]** distance between the two points

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: http://en.wikipedia.org/wiki/Haversine_formula

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.1

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/distance
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/ellipse
Description: turf ellipse module
Author: Turf Authors
Latest version: 1.0.5

# @spatial/ellipse

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## ellipse

Takes a [Point][1] and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.

### Parameters

-   `center` **[Coord][2]** center point
-   `xSemiAxis` **[number][3]** semi (major) axis of the ellipse along the x-axis
-   `ySemiAxis` **[number][3]** semi (minor) axis of the ellipse along the y-axis
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.angle` **[number][3]** angle of rotation (along the vertical axis), from North in decimal degrees, negative clockwise (optional, default `0`)
    -   `options.pivot` **[Coord][2]** point around which the rotation will be performed (optional, default `'origin'`)
    -   `options.steps` **[number][3]** number of steps (optional, default `64`)
    -   `options.units` **[string][5]** unit of measurement for axes (optional, default `'kilometers'`)
    -   `options.properties` **[Object][4]** properties (optional, default `{}`)

### Examples

```javascript
var center = [-75, 40];
var xSemiAxis = 5;
var ySemiAxis = 2;
var ellipse = turf.ellipse(center, xSemiAxis, ySemiAxis);

//addToMap
var addToMap = [turf.point(center), ellipse]
```

Returns **[Feature][6]&lt;[Polygon][7]>** ellipse polygon

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.1

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[6]: https://tools.ietf.org/html/rfc7946#section-3.2

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/ellipse
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/envelope
Description: turf envelope module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/envelope

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## envelope

Takes any number of features and returns a rectangular [Polygon][1] that encompasses all vertices.

### Parameters

-   `geojson` **[GeoJSON][2]** input features

### Examples

```javascript
var features = turf.featureCollection([
  turf.point([-75.343, 39.984], {"name": "Location A"}),
  turf.point([-75.833, 39.284], {"name": "Location B"}),
  turf.point([-75.534, 39.123], {"name": "Location C"})
]);

var enveloped = turf.envelope(features);

//addToMap
var addToMap = [features, enveloped];
```

Returns **[Feature][3]&lt;[Polygon][4]>** a rectangular Polygon feature that encompasses all vertices

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[2]: https://tools.ietf.org/html/rfc7946#section-3

[3]: https://tools.ietf.org/html/rfc7946#section-3.2

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/envelope
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/explode
Description: turf explode module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/explode

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## explode

Takes a feature or set of features and returns all positions as [points][1].

### Parameters

-   `geojson` **[GeoJSON][2]** input features

### Examples

```javascript
var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);

var explode = turf.explode(polygon);

//addToMap
var addToMap = [polygon, explode]
```

-   Throws **[Error][3]** if it encounters an unknown geometry type

Returns **[FeatureCollection][4]&lt;point>** points representing the exploded input features

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[2]: https://tools.ietf.org/html/rfc7946#section-3

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error

[4]: https://tools.ietf.org/html/rfc7946#section-3.3

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/explode
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/flatten
Description: turf flatten module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/flatten

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## flatten

Flattens any [GeoJSON][1] to a [FeatureCollection][2] inspired by [geojson-flatten][3].

### Parameters

-   `geojson` **[GeoJSON][4]** any valid GeoJSON Object

### Examples

```javascript
var multiGeometry = turf.multiPolygon([
  [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]],
  [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]],
  [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]]
]);

var flatten = turf.flatten(multiGeometry);

//addToMap
var addToMap = [flatten]
```

Returns **[FeatureCollection][5]&lt;any>** all Multi-Geometries are flattened into single Features

[1]: https://tools.ietf.org/html/rfc7946#section-3

[2]: https://tools.ietf.org/html/rfc7946#section-3.3

[3]: https://github.com/tmcw/geojson-flatten

[4]: https://tools.ietf.org/html/rfc7946#section-3

[5]: https://tools.ietf.org/html/rfc7946#section-3.3

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/flatten
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/flip
Description: turf flip module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/flip

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## flip

Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`.

### Parameters

-   `geojson` **[GeoJSON][1]** input features
-   `options` **[Object][2]** Optional parameters (optional, default `{}`)
    -   `options.mutate` **[boolean][3]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

### Examples

```javascript
var serbia = turf.point([20.566406, 43.421008]);

var saudiArabia = turf.flip(serbia);

//addToMap
var addToMap = [serbia, saudiArabia];
```

Returns **[GeoJSON][1]** a feature or set of features of the same type as `input` with flipped coordinates

[1]: https://tools.ietf.org/html/rfc7946#section-3

[2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/flip
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/great-circle
Description: turf great-circle module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/great-circle

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## greatCircle

Calculate great circles routes as [LineString][1]

### Parameters

-   `start` **[Coord][2]** source point feature
-   `end` **[Coord][2]** destination point feature
-   `options` **[Object][3]** Optional parameters (optional, default `{}`)
    -   `options.properties` **[Object][3]** line feature properties (optional, default `{}`)
    -   `options.npoints` **[number][4]** number of points (optional, default `100`)
    -   `options.offset` **[number][4]** offset controls the likelyhood that lines will
        be split which cross the dateline. The higher the number the more likely. (optional, default `10`)

### Examples

```javascript
var start = turf.point([-122, 48]);
var end = turf.point([-77, 39]);

var greatCircle = turf.greatCircle(start, end, {'name': 'Seattle to DC'});

//addToMap
var addToMap = [start, end, greatCircle]
```

Returns **[Feature][5]&lt;[LineString][6]>** great circle line feature

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.4

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.1

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[5]: https://tools.ietf.org/html/rfc7946#section-3.2

[6]: https://tools.ietf.org/html/rfc7946#section-3.1.4

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/great-circle
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/hex-grid
Description: turf hex-grid module
Author: Turf Authors
Latest version: 1.0.5

# @spatial/hex-grid

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## hexGrid

Takes a bounding box and the diameter of the cell and returns a [FeatureCollection][1] of flat-topped
hexagons or triangles ([Polygon][2] features) aligned in an "odd-q" vertical grid as
described in [Hexagonal Grids][3].

### Parameters

-   `bbox` **[BBox][4]** extent in [minX, minY, maxX, maxY] order
-   `cellSide` **[number][5]** length of the side of the the hexagons or triangles, in units. It will also coincide with the
    radius of the circumcircle of the hexagons.
-   `options` **[Object][6]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][7]** used in calculating cell size, can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
    -   `options.properties` **[Object][6]** passed to each hexagon or triangle of the grid (optional, default `{}`)
    -   `options.mask` **[Feature][8]&lt;([Polygon][9] \| [MultiPolygon][10])>?** if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
    -   `options.triangles` **[boolean][11]** whether to return as triangles instead of hexagons (optional, default `false`)

### Examples

```javascript
var bbox = [-96,31,-84,40];
var cellSide = 50;
var options = {units: 'miles'};

var hexgrid = turf.hexGrid(bbox, cellSide, options);

//addToMap
var addToMap = [hexgrid];
```

Returns **[FeatureCollection][12]&lt;[Polygon][9]>** a hexagonal grid

[1]: https://tools.ietf.org/html/rfc7946#section-3.3

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[3]: http://www.redblobgames.com/grids/hexagons/

[4]: https://tools.ietf.org/html/rfc7946#section-5

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[8]: https://tools.ietf.org/html/rfc7946#section-3.2

[9]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[10]: https://tools.ietf.org/html/rfc7946#section-3.1.7

[11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[12]: https://tools.ietf.org/html/rfc7946#section-3.3

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/hex-grid
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/interpolate
Description: turf interpolate module
Author: Turf Authors
Latest version: 1.0.5

# @spatial/interpolate

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## interpolate

Takes a set of points and estimates their 'property' values on a grid using the [Inverse Distance Weighting (IDW) method][1].

### Parameters

-   `points` **[FeatureCollection][2]&lt;[Point][3]>** with known value
-   `cellSize` **[number][4]** the distance across each grid point
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.gridType` **[string][6]** defines the output format based on a Grid Type (options: 'square' | 'point' | 'hex' | 'triangle') (optional, default `'square'`)
    -   `options.property` **[string][6]** the property name in `points` from which z-values will be pulled, zValue fallbacks to 3rd coordinate if no property exists. (optional, default `'elevation'`)
    -   `options.units` **[string][6]** used in calculating cellSize, can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
    -   `options.weight` **[number][4]** exponent regulating the distance-decay weighting (optional, default `1`)

### Examples

```javascript
var points = turf.randomPoint(30, {bbox: [50, 30, 70, 50]});

// add a random property to each point
turf.featureEach(points, function(point) {
    point.properties.solRad = Math.random() * 50;
});
var options = {gridType: 'points', property: 'solRad', units: 'miles'};
var grid = turf.interpolate(points, 100, options);

//addToMap
var addToMap = [grid];
```

Returns **[FeatureCollection][2]&lt;([Point][3] \| [Polygon][7])>** grid of points or polygons with interpolated 'property'

[1]: https://en.wikipedia.org/wiki/Inverse_distance_weighting

[2]: https://tools.ietf.org/html/rfc7946#section-3.3

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.6

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/interpolate
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/intersect
Description: turf intersect module
Author: Turf Authors
Latest version: 1.0.5

# @spatial/intersect

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## intersect

Takes two [polygons][1] and finds their intersection. If they share a border, returns the border; if they don't intersect, returns undefined.

### Parameters

-   `poly1` **[Feature][2]&lt;[Polygon][3]>** the first polygon
-   `poly2` **[Feature][2]&lt;[Polygon][3]>** the second polygon

### Examples

```javascript
var poly1 = turf.polygon([[
  [-122.801742, 45.48565],
  [-122.801742, 45.60491],
  [-122.584762, 45.60491],
  [-122.584762, 45.48565],
  [-122.801742, 45.48565]
]]);

var poly2 = turf.polygon([[
  [-122.520217, 45.535693],
  [-122.64038, 45.553967],
  [-122.720031, 45.526554],
  [-122.669906, 45.507309],
  [-122.723464, 45.446643],
  [-122.532577, 45.408574],
  [-122.487258, 45.477466],
  [-122.520217, 45.535693]
]]);

var intersection = turf.intersect(poly1, poly2);

//addToMap
var addToMap = [poly1, poly2, intersection];
```

Returns **([Feature][2] | null)** returns a feature representing the point(s) they share (in case of a [Point][4]  or [MultiPoint][5]), the borders they share (in case of a [LineString][6] or a [MultiLineString][7]), the area they share (in case of [Polygon][1] or [MultiPolygon][8]). If they do not share any point, returns `null`.

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[2]: https://tools.ietf.org/html/rfc7946#section-3.2

[3]: https://tools.ietf.org/html/rfc7946#section-3.1.6

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[5]: https://tools.ietf.org/html/rfc7946#section-3.1.3

[6]: https://tools.ietf.org/html/rfc7946#section-3.1.4

[7]: https://tools.ietf.org/html/rfc7946#section-3.1.5

[8]: https://tools.ietf.org/html/rfc7946#section-3.1.7

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/intersect
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```
npm package: @spatial/isobands
Description: turf isobands module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/isobands

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

## isobands

Takes a grid [FeatureCollection][1] of [Point][2] features with z-values and an array of
value breaks and generates filled contour isobands.

### Parameters

-   `pointGrid` **[FeatureCollection][3]&lt;[Point][4]>** input points
-   `breaks` **[Array][5]&lt;[number][6]>** where to draw contours
-   `options` **[Object][7]** options on output (optional, default `{}`)
    -   `options.zProperty` **[string][8]** the property name in `points` from which z-values will be pulled (optional, default `'elevation'`)
    -   `options.commonProperties` **[Object][7]** GeoJSON properties passed to ALL isobands (optional, default `{}`)
    -   `options.breaksProperties` **[Array][5]&lt;[Object][7]>** GeoJSON properties passed, in order, to the correspondent isoband (order defined by breaks) (optional, default `[]`)

Returns **[FeatureCollection][3]&lt;[MultiPolygon][9]>** a FeatureCollection of [MultiPolygon][10] features representing isobands

[1]: https://tools.ietf.org/html/rfc7946#section-3.3

[2]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[3]: https://tools.ietf.org/html/rfc7946#section-3.3

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.2

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

[9]: https://tools.ietf.org/html/rfc7946#section-3.1.7

[10]: https://tools.ietf.org/html/rfc7946#section-3.1.7

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
./scripts/generate-readmes in the turf project. -->

---

This module is part of the [Turfjs project](http://turfjs.org/), an open source
module collection dedicated to geographic algorithms. It is maintained in the
[Turfjs/turf](https://github.com/Turfjs/turf) repository, where you can create
PRs and issues.

### Installation

Install this module individually:

```sh
$ npm install @spatial/isobands
```

Or install the Turf module that includes it as a function:

```sh
$ npm install @turf/turf
```