-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3722756
commit 30cfe71
Showing
173 changed files
with
12,573 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
--- | ||
title: along | ||
--- | ||
|
||
import * as turf from "turf-next"; | ||
import ExampleMap from "@site/src/components/ExampleMap"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
### Description | ||
|
||
Takes a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) and returns a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) at a specified distance along the line. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | ||
| line | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | input line | | ||
| distance | **number** | distance along the line | | ||
| options<i>?</i> | **Object** | Optional parameters | | ||
| options.units<i>?</i> | **string** | can be degrees, radians, miles, or kilometers _(default "kilometers")_ | | ||
|
||
### Returns | ||
|
||
<ul> | ||
**[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** Point `distance` `units` along the line | ||
|
||
</ul> | ||
|
||
### Examples | ||
|
||
```javascript | ||
var line = turf.lineString([ | ||
[-83, 30], | ||
[-84, 36], | ||
[-78, 41], | ||
]); | ||
var options = { units: "miles" }; | ||
|
||
var along = turf.along(line, 200, options); | ||
``` | ||
|
||
export function Map0() { | ||
"use strict"; | ||
|
||
// jsdoc example start | ||
var line = turf.lineString([ | ||
[-83, 30], | ||
[-84, 36], | ||
[-78, 41], | ||
]); | ||
var options = { units: "miles" }; | ||
|
||
var along = turf.along(line, 200, options); | ||
|
||
//addToMap | ||
var addToMap = { along, line }; | ||
// jsdoc example end | ||
|
||
return <ExampleMap addToMap={addToMap} />; | ||
} | ||
|
||
<!-- prettier-ignore --> | ||
<BrowserOnly>{() => <Map0 />}</BrowserOnly> | ||
|
||
### Installation | ||
|
||
```javascript | ||
$ npm install @turf/along | ||
|
||
import { along } from "@turf/along"; | ||
const result = along(...); | ||
``` | ||
|
||
```javascript | ||
$ npm install @turf/turf | ||
|
||
import * as turf from "@turf/turf"; | ||
const result = turf.along(...); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
--- | ||
title: angle | ||
--- | ||
|
||
import * as turf from "turf-next"; | ||
import ExampleMap from "@site/src/components/ExampleMap"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
### Description | ||
|
||
Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise) | ||
angle with origin on the `startPoint-midPoint` segment, or its explementary angle if required. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| ---------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------- | | ||
| startPoint | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | Start Point Coordinates | | ||
| midPoint | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | Mid Point Coordinates | | ||
| endPoint | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | End Point Coordinates | | ||
| options<i>?</i> | **Object** | Optional parameters _(default \{\})_ | | ||
| options.explementary<i>?</i> | **boolean** | Returns the explementary angle instead (360 - angle) _(default false)_ | | ||
| options.mercator<i>?</i> | **boolean** | if calculations should be performed over Mercator or WGS84 projection _(default false)_ | | ||
|
||
### Returns | ||
|
||
<ul> | ||
**number** Angle between the provided points, or its explementary. | ||
|
||
</ul> | ||
|
||
### Examples | ||
|
||
```javascript | ||
turf.angle([5, 5], [5, 6], [3, 4]); | ||
//=45 | ||
``` | ||
|
||
### Installation | ||
|
||
```javascript | ||
$ npm install @turf/angle | ||
|
||
import { angle } from "@turf/angle"; | ||
const result = angle(...); | ||
``` | ||
|
||
```javascript | ||
$ npm install @turf/turf | ||
|
||
import * as turf from "@turf/turf"; | ||
const result = turf.angle(...); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
title: area | ||
--- | ||
|
||
import * as turf from "turf-next"; | ||
import ExampleMap from "@site/src/components/ExampleMap"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
### Description | ||
|
||
Takes one or more features and returns their area in square meters. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| ------- | ------------------------------------------------------------ | ------------------------ | | ||
| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input GeoJSON feature(s) | | ||
|
||
### Returns | ||
|
||
<ul> | ||
**number** area in square meters | ||
|
||
</ul> | ||
|
||
### Examples | ||
|
||
```javascript | ||
var polygon = turf.polygon([ | ||
[ | ||
[125, -15], | ||
[113, -22], | ||
[154, -27], | ||
[144, -15], | ||
[125, -15], | ||
], | ||
]); | ||
|
||
var area = turf.area(polygon); | ||
``` | ||
|
||
export function Map0() { | ||
"use strict"; | ||
|
||
// jsdoc example start | ||
var polygon = turf.polygon([ | ||
[ | ||
[125, -15], | ||
[113, -22], | ||
[154, -27], | ||
[144, -15], | ||
[125, -15], | ||
], | ||
]); | ||
|
||
var area = turf.area(polygon); | ||
|
||
//addToMap | ||
var addToMap = { polygon }; | ||
polygon.properties.area = area; | ||
// jsdoc example end | ||
|
||
return <ExampleMap addToMap={addToMap} />; | ||
} | ||
|
||
<!-- prettier-ignore --> | ||
<BrowserOnly>{() => <Map0 />}</BrowserOnly> | ||
|
||
### Installation | ||
|
||
```javascript | ||
$ npm install @turf/area | ||
|
||
import { area } from "@turf/area"; | ||
const result = area(...); | ||
``` | ||
|
||
```javascript | ||
$ npm install @turf/turf | ||
|
||
import * as turf from "@turf/turf"; | ||
const result = turf.area(...); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: bbox | ||
--- | ||
|
||
import * as turf from "turf-next"; | ||
import ExampleMap from "@site/src/components/ExampleMap"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
### Description | ||
|
||
Calculates the bounding box for any GeoJSON object, including FeatureCollection. | ||
Uses geojson.bbox if available and options.recompute is not set. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------ | | ||
| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any GeoJSON object | | ||
| options<i>?</i> | **Object** | Optional parameters _(default \{\})_ | | ||
| options.recompute<i>?</i> | **boolean** | Whether to ignore an existing bbox property on geojson | | ||
|
||
### Returns | ||
|
||
<ul> | ||
**[BBox](https://tools.ietf.org/html/rfc7946#section-5)** bbox extent in [minX, minY, maxX, maxY] order | ||
|
||
</ul> | ||
|
||
### Examples | ||
|
||
```javascript | ||
var line = turf.lineString([ | ||
[-74, 40], | ||
[-78, 42], | ||
[-82, 35], | ||
]); | ||
var bbox = turf.bbox(line); | ||
var bboxPolygon = turf.bboxPolygon(bbox); | ||
``` | ||
|
||
export function Map0() { | ||
"use strict"; | ||
|
||
// jsdoc example start | ||
var line = turf.lineString([ | ||
[-74, 40], | ||
[-78, 42], | ||
[-82, 35], | ||
]); | ||
var bbox = turf.bbox(line); | ||
var bboxPolygon = turf.bboxPolygon(bbox); | ||
|
||
//addToMap | ||
var addToMap = { line, bboxPolygon }; | ||
// jsdoc example end | ||
|
||
return <ExampleMap addToMap={addToMap} />; | ||
} | ||
|
||
<!-- prettier-ignore --> | ||
<BrowserOnly>{() => <Map0 />}</BrowserOnly> | ||
|
||
### Installation | ||
|
||
```javascript | ||
$ npm install @turf/bbox | ||
|
||
import { bbox } from "@turf/bbox"; | ||
const result = bbox(...); | ||
``` | ||
|
||
```javascript | ||
$ npm install @turf/turf | ||
|
||
import * as turf from "@turf/turf"; | ||
const result = turf.bbox(...); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
--- | ||
title: bboxClip | ||
--- | ||
|
||
import * as turf from "turf-next"; | ||
import ExampleMap from "@site/src/components/ExampleMap"; | ||
import BrowserOnly from "@docusaurus/BrowserOnly"; | ||
|
||
### Description | ||
|
||
Takes a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) and a bbox and clips the feature to the bbox using | ||
[lineclip](https://github.com/mapbox/lineclip). | ||
May result in degenerate edges when clipping Polygons. | ||
|
||
### Parameters | ||
|
||
| Name | Type | Description | | ||
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- | | ||
| feature | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | feature to clip to the bbox | | ||
| bbox | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | extent in [minX, minY, maxX, maxY] order | | ||
|
||
### Returns | ||
|
||
<ul> | ||
**[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** clipped Feature | ||
|
||
</ul> | ||
|
||
### Examples | ||
|
||
```javascript | ||
var bbox = [0, 0, 10, 10]; | ||
var poly = turf.polygon([ | ||
[ | ||
[2, 2], | ||
[8, 4], | ||
[12, 8], | ||
[3, 7], | ||
[2, 2], | ||
], | ||
]); | ||
|
||
var clipped = turf.bboxClip(poly, bbox); | ||
``` | ||
|
||
export function Map0() { | ||
"use strict"; | ||
|
||
// jsdoc example start | ||
var bbox = [0, 0, 10, 10]; | ||
var poly = turf.polygon([ | ||
[ | ||
[2, 2], | ||
[8, 4], | ||
[12, 8], | ||
[3, 7], | ||
[2, 2], | ||
], | ||
]); | ||
|
||
var clipped = turf.bboxClip(poly, bbox); | ||
|
||
//addToMap | ||
var addToMap = { bbox, poly, clipped }; | ||
// jsdoc example end | ||
|
||
return <ExampleMap addToMap={addToMap} />; | ||
} | ||
|
||
<!-- prettier-ignore --> | ||
<BrowserOnly>{() => <Map0 />}</BrowserOnly> | ||
|
||
### Installation | ||
|
||
```javascript | ||
$ npm install @turf/bbox-clip | ||
|
||
import { bboxClip } from "@turf/bbox-clip"; | ||
const result = bboxClip(...); | ||
``` | ||
|
||
```javascript | ||
$ npm install @turf/turf | ||
|
||
import * as turf from "@turf/turf"; | ||
const result = turf.bboxClip(...); | ||
``` |
Oops, something went wrong.