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

Updates Documentation from Strings to Units #2838

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
4 changes: 3 additions & 1 deletion packages/turf-along/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t
* `distance` **[number][4]** distance along the line
* `options` **[Object][5]?** Optional parameters (optional, default `{}`)

* `options.units` **Units** can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
* `options.units` **Units** Supports all valid Turf [Units][6]. (optional, default `"kilometers"`)

### Examples

Expand All @@ -38,6 +38,8 @@ Returns **[Feature][3]<[Point][2]>** Point `distance` `units` along the line

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

[6]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

<!-- This file is automatically generated. Please don't edit it directly. If you find an error, edit the source file of the module in question (likely index.js or index.ts), and re-run "yarn docs" from the root of the turf project. -->

---
Expand Down
2 changes: 1 addition & 1 deletion packages/turf-along/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { getGeom } from "@turf/invariant";
* @param {Feature<LineString>|LineString} line input line
* @param {number} distance distance along the line
* @param {Object} [options] Optional parameters
* @param {Units} [options.units="kilometers"] can be degrees, radians, miles, or kilometers
* @param {Units} [options.units="kilometers"] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @returns {Feature<Point>} Point `distance` `units` along the line
* @example
* var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);
Expand Down
6 changes: 3 additions & 3 deletions packages/turf-buffer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## buffer

Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
Calculates a buffer for input features for a given radius.

When using a negative radius, the resulting geometry may be invalid if
it's too small compared to the radius magnitude. If the input is a
Expand All @@ -18,7 +18,7 @@ the input, or even be empty.
* `radius` **[number][4]** distance to draw the buffer (negative values are allowed)
* `options` **[Object][5]** Optional parameters (optional, default `{}`)

* `options.units` **[string][6]** any of the options supported by turf units (optional, default `"kilometers"`)
* `options.units` **Units** Supports all valid Turf [Units][6]. (optional, default `"kilometers"`)
* `options.steps` **[number][4]** number of steps (optional, default `8`)

### Examples
Expand All @@ -43,7 +43,7 @@ Returns **([FeatureCollection][1] | [Feature][3]<([Polygon][7] | [MultiPolygon][

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

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[6]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
6 changes: 3 additions & 3 deletions packages/turf-buffer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts;

/**
* Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees.
* Calculates a buffer for input features for a given radius.
*
* When using a negative radius, the resulting geometry may be invalid if
* it's too small compared to the radius magnitude. If the input is a
Expand All @@ -25,7 +25,7 @@ const { BufferOp, GeoJSONReader, GeoJSONWriter } = jsts;
* @param {FeatureCollection|Geometry|Feature<any>} geojson input to be buffered
* @param {number} radius distance to draw the buffer (negative values are allowed)
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units="kilometers"] any of the options supported by turf units
* @param {Units} [options.units="kilometers"] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @param {number} [options.steps=8] number of steps
* @returns {FeatureCollection|Feature<Polygon|MultiPolygon>|undefined} buffered features
* @example
Expand Down Expand Up @@ -80,7 +80,7 @@ function buffer(geojson, radius, options) {
* @private
* @param {Feature<any>} geojson input to be buffered
* @param {number} radius distance to draw the buffer
* @param {string} [units='kilometers'] any of the options supported by turf units
* @param {Units} [units='kilometers'] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @param {number} [steps=8] number of steps
* @returns {Feature<Polygon|MultiPolygon>} buffered feature
*/
Expand Down
26 changes: 13 additions & 13 deletions packages/turf-circle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

## circle

Takes a [Point][1] and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
Takes a [Point][1] and calculates the circle polygon given a radius in [Units][2]; and steps for precision.

### Parameters

* `center` **([Feature][2]<[Point][1]> | [Array][3]<[number][4]>)** center point
* `radius` **[number][4]** radius of the circle
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
* `center` **([Feature][3]<[Point][1]> | [Array][4]<[number][5]>)** center point
* `radius` **[number][5]** radius of the circle
* `options` **[Object][6]** Optional parameters (optional, default `{}`)

* `options.steps` **[number][4]** number of steps (optional, default `64`)
* `options.units` **[string][6]** miles, kilometers, degrees, or radians (optional, default `'kilometers'`)
* `options.properties` **[Object][5]** properties (optional, default `{}`)
* `options.steps` **[number][5]** number of steps (optional, default `64`)
* `options.units` **Units** Supports all valid Turf [Units][2] (optional, default `'kilometers'`)
* `options.properties` **[Object][6]** properties (optional, default `{}`)

### Examples

Expand All @@ -28,19 +28,19 @@ var circle = turf.circle(center, radius, options);
var addToMap = [turf.point(center), circle]
```

Returns **[Feature][2]<[Polygon][7]>** circle polygon
Returns **[Feature][3]<[Polygon][7]>** circle polygon

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

[2]: https://tools.ietf.org/html/rfc7946#section-3.2
[2]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

[3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array
[3]: https://tools.ietf.org/html/rfc7946#section-3.2

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

[5]: 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/String
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

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

Expand Down
4 changes: 2 additions & 2 deletions packages/turf-circle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ import { destination } from "@turf/destination";
import { polygon, Units } from "@turf/helpers";

/**
* Takes a {@link Point} and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision.
* Takes a {@link Point} and calculates the circle polygon given a radius in {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}; and steps for precision.
*
* @function
* @param {Feature<Point>|number[]} center center point
* @param {number} radius radius of the circle
* @param {Object} [options={}] Optional parameters
* @param {number} [options.steps=64] number of steps
* @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}
* @param {Object} [options.properties={}] properties
* @returns {Feature<Polygon>} circle polygon
* @example
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-clusters-dbscan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Takes a set of [points][4] and partition them into clusters according to [DBSCAN
* `maxDistance` **[number][3]** Maximum Distance between any point of the cluster to generate the clusters (kilometers by default, see options)
* `options` **[Object][1]** Optional parameters (optional, default `{}`)

* `options.units` **[string][7]** in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
* `options.units` **Units** in which `maxDistance` is expressed, Supports all valid Turf [Units][7] (optional, default `"kilometers"`)
* `options.mutate` **[boolean][8]** Allows GeoJSON input to be mutated (optional, default `false`)
* `options.minPoints` **[number][3]** 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`)
Expand Down Expand Up @@ -63,7 +63,7 @@ Returns **[FeatureCollection][6]<[Point][4], [DbscanProps][9]>** Clustered Point

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

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[7]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-clusters-dbscan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type IndexedPoint = {
* @param {FeatureCollection<Point>} points to be clustered
* @param {number} maxDistance Maximum Distance between any point of the cluster to generate the clusters (kilometers by default, see options)
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units="kilometers"] in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers
* @param {Units} [options.units="kilometers"] in which `maxDistance` is expressed, Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}
* @param {boolean} [options.mutate=false] Allows GeoJSON input to be mutated
* @param {number} [options.minPoints=3] Minimum number of points to generate a single cluster,
* points which do not meet this requirement will be classified as an 'edge' or 'noise'.
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-concave/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Internally, this uses [turf-tin][2] to generate geometries.

* `options.maxEdge` **[number][5]** the length (in 'units') of an edge necessary for part of the
hull to become concave. (optional, default `Infinity`)
* `options.units` **[string][6]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
* `options.units` **Units** Supports all valid Turf [Units][6]. (optional, default `'kilometers'`)

### Examples

Expand Down Expand Up @@ -47,7 +47,7 @@ Returns **([Feature][7]<([Polygon][8] | [MultiPolygon][9])> | null)** a concave

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

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[6]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-concave/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { dissolve } from "./lib/turf-dissolve.js";
* @param {Object} [options={}] Optional parameters
* @param {number} [options.maxEdge=Infinity] the length (in 'units') of an edge necessary for part of the
* hull to become concave.
* @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @returns {Feature<(Polygon|MultiPolygon)>|null} a concave hull (null value is returned if unable to compute hull)
* @example
* var points = turf.featureCollection([
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-destination/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This uses the [Haversine formula][2] to account for global curvature.
* `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.units` **Units** Supports all valid Turf [Units][6] (optional, default `'kilometers'`)
* `options.properties` **[Object][5]** Translate properties to Point (optional, default `{}`)

### Examples
Expand Down Expand Up @@ -46,7 +46,7 @@ Returns **[Feature][7]<[Point][1]>** destination point

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

[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[6]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-destination/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { getCoord } from "@turf/invariant";
* @param {number} distance distance from the origin point
* @param {number} bearing ranging from -180 to 180
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units='kilometers'] miles, kilometers, degrees, or radians
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}
* @param {Object} [options.properties={}] Translate properties to Point
* @returns {Feature<Point>} destination point
* @example
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-distance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This uses the [Haversine formula][2] to account for global curvature.
* `to` **[Coord][1]** destination coordinate
* `options` **[Object][3]** Optional parameters (optional, default `{}`)

* `options.units` **[string][4]** can be degrees, radians, miles, or kilometers (optional, default `'kilometers'`)
* `options.units` **Units** Supports all valid Turf [Units][4]. (optional, default `'kilometers'`)

### Examples

Expand All @@ -38,7 +38,7 @@ Returns **[number][5]** distance between the two coordinates

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

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[4]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-distance/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { radiansToLength, degreesToRadians, Coord, Units } from "@turf/helpers";
* @param {Coord} from origin coordinate
* @param {Coord} to destination coordinate
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units='kilometers'] can be degrees, radians, miles, or kilometers
* @param {Units} [options.units='kilometers'] Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @returns {number} distance between the two coordinates
* @example
* var from = turf.point([-75.343, 39.984]);
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-ellipse/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Takes a [Point][1] and calculates the ellipse polygon given two semi-axes expres
* `options.angle` **[number][3]** angle of rotation in decimal degrees, positive clockwise (optional, default `0`)
* `options.pivot` **[Coord][2]** point around which any rotation will be performed (optional, default `center`)
* `options.steps` **[number][3]** number of steps (optional, default `64`)
* `options.units` **[string][5]** unit of measurement for axes (optional, default `'kilometers'`)
* `options.units` **Units** unit of measurement for axes. Supports all valid Turf [Units][5] (optional, default `'kilometers'`)
* `options.properties` **[Object][4]** properties (optional, default `{}`)

### Examples
Expand All @@ -41,7 +41,7 @@ Returns **[Feature][6]<[Polygon][7]>** ellipse polygon

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

[5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[5]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-ellipse/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { GeoJsonProperties, Feature, Polygon, Position } from "geojson";
* @param {number} [options.angle=0] angle of rotation in decimal degrees, positive clockwise
* @param {Coord} [options.pivot=center] point around which any rotation will be performed
* @param {number} [options.steps=64] number of steps
* @param {string} [options.units='kilometers'] unit of measurement for axes
* @param {Units} [options.units='kilometers'] unit of measurement for axes. Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}
* @param {Object} [options.properties={}] properties
* @returns {Feature<Polygon>} ellipse polygon
* @example
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-hex-grid/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ described in [Hexagonal Grids][3].
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.units` **Units** used in calculating cell size. Supports all valid Turf [Units][7]. (optional, default `'kilometers'`)
* `options.properties` **[Object][6]** passed to each hexagon or triangle of the grid (optional, default `{}`)
* `options.mask` **[Feature][8]<[Polygon][2]>?** if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
* `options.triangles` **[boolean][9]** whether to return as triangles instead of hexagons (optional, default `false`)
Expand Down Expand Up @@ -47,7 +47,7 @@ Returns **[FeatureCollection][1]<[Polygon][2]>** a hexagonal grid

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

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
[7]: https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md

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

Expand Down
2 changes: 1 addition & 1 deletion packages/turf-hex-grid/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { polygon, featureCollection, Units } from "@turf/helpers";
* @param {number} cellSide 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.
* @param {Object} [options={}] Optional parameters
* @param {string} [options.units='kilometers'] used in calculating cell size, can be degrees, radians, miles, or kilometers
* @param {Units} [options.units='kilometers'] used in calculating cell size. Supports all valid Turf {@link https://github.com/Turfjs/turf/blob/master/packages/turf-helpers/README_UNITS.md Units}.
* @param {Object} [options.properties={}] passed to each hexagon or triangle of the grid
* @param {Feature<Polygon>} [options.mask] if passed a Polygon or MultiPolygon, the grid Points will be created only inside it
* @param {boolean} [options.triangles=false] whether to return as triangles instead of hexagons
Expand Down
Loading