open-index/open-npm huggingface dataset:
npm package: @spatial/point-to-line-distance
Description: turf point-to-line-distance module
Author: Turf Authors
Latest version: 2.0.0

# @spatial/point-to-line-distance

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

## pointToLineDistance

Returns the minimum distance between a [Point][1] and a [LineString][2], being the distance from a line the
minimum distance between the point and any segment of the `LineString`.

### Parameters

-   `pt` **[Coord][3]** Feature or Geometry
-   `line` **[Feature][4]&lt;[LineString][5]>** GeoJSON Feature or Geometry
-   `options` **[Object][6]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][7]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
    -   `options.mercator` **[boolean][8]** if distance should be on Mercator or WGS84 projection (optional, default `false`)

### Examples

```javascript
var pt = turf.point([0, 0]);
var line = turf.lineString([[1, 1],[-1, 1]]);

var distance = turf.pointToLineDistance(pt, line, {units: 'miles'});
//=69.11854715938406
```

Returns **[number][9]** distance between point and line

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

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

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

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

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

[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://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean

[9]: 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/point-to-line-distance
```

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

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

# @spatial/points-within-polygon

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

## pointsWithinPolygon

Finds [Points][1] that fall within [(Multi)Polygon(s)][2].

### Parameters

-   `points` **(Feauture | [FeatureCollection][3]&lt;[Point][4]>)** Points as input search
-   `polygons` **([FeatureCollection][3] | Geoemtry | [Feature][5]&lt;([Polygon][6] \| [MultiPolygon][7])>)** Points must be within these (Multi)Polygon(s)

### Examples

```javascript
var points = turf.points([
    [-46.6318, -23.5523],
    [-46.6246, -23.5325],
    [-46.6062, -23.5513],
    [-46.663, -23.554],
    [-46.643, -23.557]
]);

var searchWithin = turf.polygon([[
    [-46.653,-23.543],
    [-46.634,-23.5346],
    [-46.613,-23.543],
    [-46.614,-23.559],
    [-46.631,-23.567],
    [-46.653,-23.560],
    [-46.653,-23.543]
]]);

var ptsWithin = turf.pointsWithinPolygon(points, searchWithin);

//addToMap
var addToMap = [points, searchWithin, ptsWithin]
turf.featureEach(ptsWithin, function (currentFeature) {
  currentFeature.properties['marker-size'] = 'large';
  currentFeature.properties['marker-color'] = '#000';
});
```

Returns **[FeatureCollection][3]&lt;[Point][4]>** points that land within at least one polygon

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

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

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

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

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

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

[7]: 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/points-within-polygon
```

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

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

# @spatial/polygon-smooth

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

## polygonSmooth

Smooths a [Polygon][1] or [MultiPolygon][2]. Based on [Chaikin's algorithm][3].
Warning: may create degenerate polygons.

### Parameters

-   `inputPolys` **([FeatureCollection][4] \| [Feature][5]&lt;([Polygon][6] \| [MultiPolygon][7])>)** (Multi)Polygon(s) to smooth
-   `options` **[Object][8]** Optional parameters (optional, default `{}`)
    -   `options.iterations` **[string][9]** THe number of times to smooth the polygon. A higher value means a smoother polygon. (optional, default `1`)

### Examples

```javascript
var polygon = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);

var smoothed = turf.polygonSmooth(polygon, {iterations: 3})

//addToMap
var addToMap = [smoothed, polygon];
```

Returns **[FeatureCollection][4]&lt;[Polygon][6]>** FeatureCollection containing the smoothed polygon/poylgons

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

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

[3]: http://graphics.cs.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html

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

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

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

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

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

[9]: 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/polygon-smooth
```

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

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

# @spatial/polygon-tangents

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

## polygonTangents

Finds the tangents of a [(Multi)Polygon][1] from a [Point][2].

### Parameters

-   `pt` **[Coord][3]** to calculate the tangent points from
-   `polygon` **[Feature][4]&lt;([Polygon][5] \| [MultiPolygon][6])>** to get tangents from

### Examples

```javascript
var polygon = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);
var point = turf.point([61, 5]);

var tangents = turf.polygonTangents(point, polygon)

//addToMap
var addToMap = [tangents, point, polygon];
```

Returns **[FeatureCollection][7]&lt;[Point][8]>** Feature Collection containing the two tangent points

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

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

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

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

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

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

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

[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/polygon-tangents
```

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

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

# @spatial/polygon-to-line

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

## polygonToLine

Converts a [Polygon][1] to [(Multi)LineString][2] or [MultiPolygon][3] to a [FeatureCollection][4] of [(Multi)LineString][2].

### Parameters

-   `polygon` **[Feature][5]&lt;([Polygon][6] \| [MultiPolygon][7])>** Feature to convert
-   `options` **[Object][8]** Optional parameters (optional, default `{}`)
    -   `options.properties` **[Object][8]** translates GeoJSON properties to Feature (optional, default `{}`)

### Examples

```javascript
var poly = turf.polygon([[[125, -30], [145, -30], [145, -20], [125, -20], [125, -30]]]);

var line = turf.polygonToLine(poly);

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

Returns **([FeatureCollection][9] \| [Feature][5]&lt;([LineString][10] | MultiLinestring)>)** converted (Multi)Polygon to (Multi)LineString

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

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

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

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

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

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

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

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

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

[10]: 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/polygon-to-line
```

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

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

# @spatial/polygonize

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

## polygonize

Polygonizes [(Multi)LineString(s)][1] into [Polygons][2].

Implementation of GEOSPolygonize function (`geos::operation::polygonize::Polygonizer`).

Polygonizes a set of lines that represents edges in a planar graph. Edges must be correctly
noded, i.e., they must only meet at their endpoints.

The implementation correctly handles:

-   Dangles: edges which have one or both ends which are not incident on another edge endpoint.
-   Cut Edges (bridges): edges that are connected at both ends but which do not form part of a polygon.

### Parameters

-   `geoJson` **([FeatureCollection][3] \| [Geometry][4] \| [Feature][5]&lt;([LineString][6] \| [MultiLineString][7])>)** Lines in order to polygonize


-   Throws **[Error][8]** if geoJson is invalid.

Returns **[FeatureCollection][3]&lt;[Polygon][9]>** Polygons created

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

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

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

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

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

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

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

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

[9]: 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/polygonize
```

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

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

# @spatial/projection

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

## toMercator

Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection

### Parameters

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

### Examples

```javascript
var pt = turf.point([-71,41]);
var converted = turf.toMercator(pt);

//addToMap
var addToMap = [pt, converted];
```

Returns **[GeoJSON][1]** true/false

## toWgs84

Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection

### Parameters

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

### Examples

```javascript
var pt = turf.point([-7903683.846322424, 5012341.663847514]);
var converted = turf.toWgs84(pt);

//addToMap
var addToMap = [pt, converted];
```

Returns **[GeoJSON][1]** true/false

[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/projection
```

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

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

# @spatial/rewind

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

## rewind

Rewind [(Multi)LineString][1] or [(Multi)Polygon][2] outer ring counterclockwise and inner rings clockwise (Uses [Shoelace Formula][3]).

### Parameters

-   `geojson` **[GeoJSON][4]** input GeoJSON Polygon
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.reverse` **[boolean][6]** enable reverse winding (optional, default `false`)
    -   `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

### Examples

```javascript
var polygon = turf.polygon([[[121, -29], [138, -29], [138, -18], [121, -18], [121, -29]]]);

var rewind = turf.rewind(polygon);

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

Returns **[GeoJSON][4]** rewind Polygon

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

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

[3]: http://en.wikipedia.org/wiki/Shoelace_formula

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

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

[6]: 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/rewind
```

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

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

# @spatial/rhumb-bearing

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

## rhumbBearing

Takes two [points][1] and finds the bearing angle between them along a Rhumb line
i.e. the angle measured in degrees start the north line (0 degrees)

### Parameters

-   `start` **[Coord][2]** starting Point
-   `end` **[Coord][2]** ending Point
-   `options` **[Object][3]?** Optional parameters
    -   `options.final` **[boolean][4]** calculates the final bearing if true (optional, default `false`)

### Examples

```javascript
var point1 = turf.point([-75.343, 39.984], {"marker-color": "#F00"});
var point2 = turf.point([-75.534, 39.123], {"marker-color": "#00F"});

var bearing = turf.rhumbBearing(point1, point2);

//addToMap
var addToMap = [point1, point2];
point1.properties.bearing = bearing;
point2.properties.bearing = bearing;
```

Returns **[number][5]** bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise)

[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/Object

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

[5]: 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/rhumb-bearing
```

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

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

# @spatial/rhumb-destination

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

## rhumbDestination

Returns the destination [Point][1] having travelled the given distance along a Rhumb line from the
origin Point with the (varant) given bearing.

### Parameters

-   `origin` **[Coord][2]** starting point
-   `distance` **[number][3]** distance from the starting point
-   `bearing` **[number][3]** varant bearing angle ranging from -180 to 180 degrees from north
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][5]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
    -   `options.properties` **[Object][4]** translate properties to destination point (optional, default `{}`)

### Examples

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

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

//addToMap
var addToMap = [pt, destination]
destination.properties['marker-color'] = '#00F';
```

Returns **[Feature][6]&lt;[Point][7]>** Destination point.

[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.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/rhumb-destination
```

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

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

# @spatial/rhumb-distance

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

## rhumbDistance

Calculates the distance along a rhumb line between two [points][1] in degrees, radians,
miles, or kilometers.

### Parameters

-   `from` **[Coord][2]** origin point
-   `to` **[Coord][2]** destination point
-   `options` **[Object][3]?** Optional parameters
    -   `options.units` **[string][4]** 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.rhumbDistance(from, to, options);

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

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

[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/Object

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

[5]: 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/rhumb-distance
```

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

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

# @spatial/sample

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

## sample

Takes a [FeatureCollection][1] and returns a FeatureCollection with given number of [features][2] at random.

### Parameters

-   `featurecollection` **[FeatureCollection][3]** set of input features
-   `num` **[number][4]** number of features to select

### Examples

```javascript
var points = turf.randomPoint(100, {bbox: [-80, 30, -60, 60]});

var sample = turf.sample(points, 5);

//addToMap
var addToMap = [points, sample]
turf.featureEach(sample, function (currentFeature) {
  currentFeature.properties['marker-size'] = 'large';
  currentFeature.properties['marker-color'] = '#000';
});
```

Returns **[FeatureCollection][3]** a FeatureCollection with `n` features

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

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

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

[4]: 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/sample
```

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

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

# @spatial/sector

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

## sector

Creates a circular sector of a circle of given radius and center [Point][1],
between (clockwise) bearing1 and bearing2; 0 bearing is North of center point, positive clockwise.

### Parameters

-   `center` **[Coord][2]** center point
-   `radius` **[number][3]** radius of the circle
-   `bearing1` **[number][3]** angle, in decimal degrees, of the first radius of the sector
-   `bearing2` **[number][3]** angle, in decimal degrees, of the second radius of the sector
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][5]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
    -   `options.steps` **[number][3]** number of steps (optional, default `64`)

### Examples

```javascript
var center = turf.point([-75, 40]);
var radius = 5;
var bearing1 = 25;
var bearing2 = 45;

var sector = turf.sector(center, radius, bearing1, bearing2);

//addToMap
var addToMap = [center, sector];
```

Returns **[Feature][6]&lt;[Polygon][7]>** sector 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/sector
```

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

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

# @spatial/shortest-path

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

## shortestPath

Returns the shortest [path][1] from [start][2] to [end][2] without colliding with
any [Feature][3] in [ obstacles][4]

### Parameters

-   `start` **[Coord][5]** point
-   `end` **[Coord][5]** point
-   `options` **[Object][6]** optional parameters (optional, default `{}`)
    -   `options.obstacles` **([Geometry][7] \| [Feature][8] \| [FeatureCollection][9]&lt;[Polygon][10]>)?** areas which path cannot travel
    -   `options.minDistance` **[number][11]?** minimum distance between shortest path and obstacles
    -   `options.units` **[string][12]** unit in which resolution & minimum distance will be expressed in; it can be degrees, radians, miles, kilometers, ... (optional, default `'kilometers'`)
    -   `options.resolution` **[number][11]** distance between matrix points on which the path will be calculated (optional, default `100`)

### Examples

```javascript
var start = [-5, -6];
var end = [9, -6];
var options = {
  obstacles: turf.polygon([[[0, -7], [5, -7], [5, -3], [0, -3], [0, -7]]])
};

var path = turf.shortestPath(start, end, options);

//addToMap
var addToMap = [start, end, options.obstacles, path];
```

Returns **[Feature][8]&lt;[LineString][13]>** shortest path between start and end

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

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

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

[4]: FeatureCollection<Polygon>

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

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

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

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

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

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

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

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

[13]: 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/shortest-path
```

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

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

# @spatial/simplify

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

## simplify

Takes a [GeoJSON][1] object and returns a simplified version. Internally uses
[simplify-js][2] to perform simplification using the Ramer-Douglas-Peucker algorithm.

### Parameters

-   `geojson` **[GeoJSON][3]** object to be simplified
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.tolerance` **[number][5]** simplification tolerance (optional, default `1`)
    -   `options.highQuality` **[boolean][6]** whether or not to spend more time to create a higher-quality simplification with a different algorithm (optional, default `false`)
    -   `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

### Examples

```javascript
var geojson = turf.polygon([[
  [-70.603637, -33.399918],
  [-70.614624, -33.395332],
  [-70.639343, -33.392466],
  [-70.659942, -33.394759],
  [-70.683975, -33.404504],
  [-70.697021, -33.419406],
  [-70.701141, -33.434306],
  [-70.700454, -33.446339],
  [-70.694274, -33.458369],
  [-70.682601, -33.465816],
  [-70.668869, -33.472117],
  [-70.646209, -33.473835],
  [-70.624923, -33.472117],
  [-70.609817, -33.468107],
  [-70.595397, -33.458369],
  [-70.587158, -33.442901],
  [-70.587158, -33.426283],
  [-70.590591, -33.414248],
  [-70.594711, -33.406224],
  [-70.603637, -33.399918]
]]);
var options = {tolerance: 0.01, highQuality: false};
var simplified = turf.simplify(geojson, options);

//addToMap
var addToMap = [geojson, simplified]
```

Returns **[GeoJSON][3]** a simplified GeoJSON

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

[2]: http://mourner.github.io/simplify-js/

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

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

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

[6]: 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/simplify
```

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

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

# @spatial/square

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

## square

Takes a bounding box and calculates the minimum square bounding box that
would contain the input.

### Parameters

-   `bbox` **[BBox][1]** extent in [west, south, east, north] order

### Examples

```javascript
var bbox = [-20, -20, -15, 0];
var squared = turf.square(bbox);

//addToMap
var addToMap = [turf.bboxPolygon(bbox), turf.bboxPolygon(squared)]
```

Returns **[BBox][1]** a square surrounding `bbox`

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

<!-- 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/square
```

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

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

# @spatial/square-grid

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

## squareGrid

Creates a square grid from a bounding box, [Feature][1] or [FeatureCollection][2].

### Parameters

-   `bbox` **[Array][3]&lt;[number][4]>** extent in [minX, minY, maxX, maxY] order
-   `cellSide` **[number][4]** of each cell, in units
-   `options` **[Object][5]** Optional parameters (optional, default `{}`)
    -   `options.units` **[string][6]** used in calculating cellSide, can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
    -   `options.mask` **[Feature][7]&lt;([Polygon][8] \| [MultiPolygon][9])>?** if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
    -   `options.properties` **[Object][5]** passed to each point of the grid (optional, default `{}`)

### Examples

```javascript
var bbox = [-95, 30 ,-85, 40];
var cellSide = 50;
var options = {units: 'miles'};

var squareGrid = turf.squareGrid(bbox, cellSide, options);

//addToMap
var addToMap = [squareGrid]
```

Returns **[FeatureCollection][10]&lt;[Polygon][8]>** grid a grid of polygons

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

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

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

[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.6

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

[10]: 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/square-grid
```

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

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

# @spatial/tag

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

## tag

Takes a set of [points][1] and a set of [polygons][2] and performs a spatial join.

### Parameters

-   `points` **[FeatureCollection][3]&lt;[Point][4]>** input points
-   `polygons` **[FeatureCollection][3]&lt;[Polygon][5]>** input polygons
-   `field` **[string][6]** property in `polygons` to add to joined {<Point>} features
-   `outField` **[string][6]** property in `points` in which to store joined property from `polygons`

### Examples

```javascript
var pt1 = turf.point([-77, 44]);
var pt2 = turf.point([-77, 38]);
var poly1 = turf.polygon([[
  [-81, 41],
  [-81, 47],
  [-72, 47],
  [-72, 41],
  [-81, 41]
]], {pop: 3000});
var poly2 = turf.polygon([[
  [-81, 35],
  [-81, 41],
  [-72, 41],
  [-72, 35],
  [-81, 35]
]], {pop: 1000});

var points = turf.featureCollection([pt1, pt2]);
var polygons = turf.featureCollection([poly1, poly2]);

var tagged = turf.tag(points, polygons, 'pop', 'population');

//addToMap
var addToMap = [tagged, polygons]
```

Returns **[FeatureCollection][3]&lt;[Point][4]>** points with `containingPolyId` property containing values from `polyId`

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

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

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

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

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

[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/tag
```

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

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

# @spatial/tesselate

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

## tesselate

Tesselates a [Feature&lt;Polygon>][1] into a [FeatureCollection&lt;Polygon>][2] of triangles
using [earcut][3].

### Parameters

-   `poly` **[Feature][4]&lt;[Polygon][5]>** the polygon to tesselate

### Examples

```javascript
var poly = turf.polygon([[[11, 0], [22, 4], [31, 0], [31, 11], [21, 15], [11, 11], [11, 0]]]);
var triangles = turf.tesselate(poly);

//addToMap
var addToMap = [poly, triangles]
```

Returns **[FeatureCollection][6]&lt;[Polygon][5]>** a geometrycollection feature

[1]: Feature<Polygon>

[2]: FeatureCollection<Polygon>

[3]: https://github.com/mapbox/earcut

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

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

[6]: 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/tesselate
```

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

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

# @spatial/tin

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

## tin

Takes a set of [points][1] and creates a
[Triangulated Irregular Network][2],
or a TIN for short, returned as a collection of Polygons. These are often used
for developing elevation contour maps or stepped heat visualizations.

If an optional z-value property is provided then it is added as properties called `a`, `b`,
and `c` representing its value at each of the points that represent the corners of the
triangle.

### Parameters

-   `points` **[FeatureCollection][3]&lt;[Point][4]>** input points
-   `z` **[String][5]?** name of the property from which to pull z values
    This is optional: if not given, then there will be no extra data added to the derived triangles.

### Examples

```javascript
// generate some random point data
var points = turf.randomPoint(30, {bbox: [50, 30, 70, 50]});

// add a random property to each point between 0 and 9
for (var i = 0; i < points.features.length; i++) {
  points.features[i].properties.z = ~~(Math.random() * 9);
}
var tin = turf.tin(points, 'z');

//addToMap
var addToMap = [tin, points]
for (var i = 0; i < tin.features.length; i++) {
  var properties  = tin.features[i].properties;
  properties.fill = '#' + properties.a + properties.b + properties.c;
}
```

Returns **[FeatureCollection][3]&lt;[Polygon][6]>** TIN output

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

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

[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/String

[6]: 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/tin
```

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

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

# @spatial/transform-rotate

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

## transformRotate

Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point;
all rotations follow the right-hand rule: [https://en.wikipedia.org/wiki/Right-hand_rule][1]

### Parameters

-   `geojson` **[GeoJSON][2]** object to be rotated
-   `angle` **[number][3]** of rotation (along the vertical axis), from North in decimal degrees, negative clockwise
-   `options` **[Object][4]** Optional parameters (optional, default `{}`)
    -   `options.pivot` **[Coord][5]** point around which the rotation will be performed (optional, default `'centroid'`)
    -   `options.mutate` **[boolean][6]** allows GeoJSON input to be mutated (significant performance increase if true) (optional, default `false`)

### Examples

```javascript
var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);
var options = {pivot: [0, 25]};
var rotatedPoly = turf.transformRotate(poly, 10, options);

//addToMap
var addToMap = [poly, rotatedPoly];
rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};
```

Returns **[GeoJSON][2]** the rotated GeoJSON feature

[1]: https://en.wikipedia.org/wiki/Right-hand_rule

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

[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://tools.ietf.org/html/rfc7946#section-3.1.1

[6]: 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/transform-rotate
```

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

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