Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snapshotting 6.5.0 documentation #195

Merged
merged 1 commit into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ const config = {
label: "API",
},
{ to: "/blog", label: "Blog", position: "left" },
{
type: "docsVersionDropdown",
position: "right",
dropdownItemsAfter: [{ to: "/versions", label: "All versions" }],
dropdownActiveClassDisabled: true,
},
{
href: "https://github.com/Turfjs/turf",
label: "GitHub",
Expand Down
15 changes: 15 additions & 0 deletions src/pages/versions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Turf documentation versions

## Current version (Stable)

| | | |
| ----- | ---------------------------- | ------------------------------------------------------------------------ |
| 6.5.0 | [Documentation](/docs/intro) | [Release Notes](https://github.com/Turfjs/turf/blob/v6.5.0/CHANGELOG.md) |

## Next version (Unreleased)

Here you can find the documentation for work-in-process unreleased version.

| | |
| --------- | --------------------------------- |
| Canary 🚧 | [Documentation](/docs/next/intro) |
79 changes: 79 additions & 0 deletions versioned_docs/version-6.5.0/api/along.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: along
---

import * as turf from "@turf/turf";
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(...);
```
53 changes: 53 additions & 0 deletions versioned_docs/version-6.5.0/api/angle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
title: angle
---

import * as turf from "@turf/turf";
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(...);
```
83 changes: 83 additions & 0 deletions versioned_docs/version-6.5.0/api/area.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
---
title: area
---

import * as turf from "@turf/turf";
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(...);
```
74 changes: 74 additions & 0 deletions versioned_docs/version-6.5.0/api/bbox.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
---
title: bbox
---

import * as turf from "@turf/turf";
import ExampleMap from "@site/src/components/ExampleMap";
import BrowserOnly from "@docusaurus/BrowserOnly";

### Description

Takes a set of features, calculates the bbox of all input features, and returns a bounding box.

### Parameters

| Name | Type | Description |
| ------- | ------------------------------------------------------------ | ------------------ |
| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any GeoJSON object |

### 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(...);
```
Loading