diff --git a/versioned_docs/version-7.0.0/api/along.mdx b/versioned_docs/version-7.0.0/api/along.mdx new file mode 100644 index 00000000..ca59a778 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/along.mdx @@ -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? | **Object** | Optional parameters | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default "kilometers")_ | + +### Returns + + + +### 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 ; +} + + +{() => } + +### 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(...); +``` diff --git a/versioned_docs/version-7.0.0/api/angle.mdx b/versioned_docs/version-7.0.0/api/angle.mdx new file mode 100644 index 00000000..8b144f23 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/angle.mdx @@ -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? | **Object** | Optional parameters _(default \{\})_ | +| options.explementary? | **boolean** | Returns the explementary angle instead (360 - angle) _(default false)_ | +| options.mercator? | **boolean** | if calculations should be performed over Mercator or WGS84 projection _(default false)_ | + +### Returns + + + +### 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(...); +``` diff --git a/versioned_docs/version-7.0.0/api/area.mdx b/versioned_docs/version-7.0.0/api/area.mdx new file mode 100644 index 00000000..c0e61727 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/area.mdx @@ -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 + + + +### 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 ; +} + + +{() => } + +### 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(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bbox.mdx b/versioned_docs/version-7.0.0/api/bbox.mdx new file mode 100644 index 00000000..246249e5 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bbox.mdx @@ -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? | **Object** | Optional parameters _(default \{\})_ | +| options.recompute? | **boolean** | Whether to ignore an existing bbox property on geojson | + +### Returns + + + +### 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 ; +} + + +{() => } + +### 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(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bboxClip.mdx b/versioned_docs/version-7.0.0/api/bboxClip.mdx new file mode 100644 index 00000000..5124021f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bboxClip.mdx @@ -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 + +
    + **[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 + +
+ +### 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 ; +} + + +{() => } + +### 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(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bboxPolygon.mdx b/versioned_docs/version-7.0.0/api/bboxPolygon.mdx new file mode 100644 index 00000000..119619c0 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bboxPolygon.mdx @@ -0,0 +1,69 @@ +--- +title: bboxPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a bbox and returns an equivalent [polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6). + +### Parameters + +| Name | Type | Description | +| -------------------------- | --------------------------------------------------------- | ------------------------------------------------ | +| bbox | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | extent in [minX, minY, maxX, maxY] order | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Properties** | Translate properties to Polygon _(default \{\})_ | +| options.id? | **string \| number** | Translate Id to Polygon _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a Polygon representation of the bounding box + +
+ +### Examples + +```javascript +var bbox = [0, 0, 10, 10]; + +var poly = turf.bboxPolygon(bbox); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [0, 0, 10, 10]; + + var poly = turf.bboxPolygon(bbox); + + //addToMap + var addToMap = { poly }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/bbox-polygon + +import { bboxPolygon } from "@turf/bbox-polygon"; +const result = bboxPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.bboxPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bearing.mdx b/versioned_docs/version-7.0.0/api/bearing.mdx new file mode 100644 index 00000000..91af3bf3 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bearing.mdx @@ -0,0 +1,75 @@ +--- +title: bearing +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and finds the geographic bearing between them, +i.e. the angle measured in degrees from the north line (0 degrees) + +### Parameters + +| Name | Type | Description | +| --------------------- | -------------------------------------------------------------- | ------------------------------------------------------ | +| start | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | starting Point | +| end | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | ending Point | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.final? | **boolean** | calculates the final bearing if true _(default false)_ | + +### Returns + +
    + **number** bearing in decimal degrees, between -180 and 180 degrees (positive clockwise) + +
+ +### Examples + +```javascript +var point1 = turf.point([-75.343, 39.984]); +var point2 = turf.point([-75.534, 39.123]); + +var bearing = turf.bearing(point1, point2); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var point1 = turf.point([-75.343, 39.984]); + var point2 = turf.point([-75.534, 39.123]); + + var bearing = turf.bearing(point1, point2); + + //addToMap + var addToMap = { point1, point2 }; + point1.properties["marker-color"] = "#f00"; + point2.properties["marker-color"] = "#0f0"; + point1.properties.bearing = bearing; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/bearing + +import { bearing } from "@turf/bearing"; +const result = bearing(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.bearing(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bearingToAzimuth.mdx b/versioned_docs/version-7.0.0/api/bearingToAzimuth.mdx new file mode 100644 index 00000000..7f61defa --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bearingToAzimuth.mdx @@ -0,0 +1,41 @@ +--- +title: bearingToAzimuth +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts any bearing angle from the north line direction (positive clockwise) +and returns an angle between 0-360 degrees (positive clockwise), 0 being the north line + +### Parameters + +| Name | Type | Description | +| ------- | ---------- | ------------------------------------ | +| bearing | **number** | angle, between -180 and +180 degrees | + +### Returns + +
    + **number** angle between 0 and 360 degrees + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { bearingToAzimuth } from "@turf/helpers"; +const result = bearingToAzimuth(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.bearingToAzimuth(...); +``` diff --git a/versioned_docs/version-7.0.0/api/bezierSpline.mdx b/versioned_docs/version-7.0.0/api/bezierSpline.mdx new file mode 100644 index 00000000..3062a93c --- /dev/null +++ b/versioned_docs/version-7.0.0/api/bezierSpline.mdx @@ -0,0 +1,89 @@ +--- +title: bezierSpline +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4) and returns a curved version +by applying a [Bezier spline](http://en.wikipedia.org/wiki/B%C3%A9zier_spline) +algorithm. + +The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc/). + +### 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 LineString | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | Translate properties to output _(default \{\})_ | +| options.resolution? | **number** | time in milliseconds between points _(default 10000)_ | +| options.sharpness? | **number** | a measure of how curvy the path should be between splines _(default 0.85)_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** curved line + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [-76.091308, 18.427501], + [-76.695556, 18.729501], + [-76.552734, 19.40443], + [-74.61914, 19.134789], + [-73.652343, 20.07657], + [-73.157958, 20.210656], +]); + +var curved = turf.bezierSpline(line); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [-76.091308, 18.427501], + [-76.695556, 18.729501], + [-76.552734, 19.40443], + [-74.61914, 19.134789], + [-73.652343, 20.07657], + [-73.157958, 20.210656], + ]); + + var curved = turf.bezierSpline(line); + + //addToMap + var addToMap = { line, curved }; + curved.properties = { stroke: "#0F0" }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/bezier-spline + +import { bezierSpline } from "@turf/bezier-spline"; +const result = bezierSpline(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.bezierSpline(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanClockwise.mdx b/versioned_docs/version-7.0.0/api/booleanClockwise.mdx new file mode 100644 index 00000000..923ea0a0 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanClockwise.mdx @@ -0,0 +1,62 @@ +--- +title: booleanClockwise +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a ring and return true or false whether or not the ring is clockwise or counter-clockwise. + +### 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)\> \| [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| Array\\>** | to be evaluated | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var clockwiseRing = turf.lineString([ + [0, 0], + [1, 1], + [1, 0], + [0, 0], +]); +var counterClockwiseRing = turf.lineString([ + [0, 0], + [1, 0], + [1, 1], + [0, 0], +]); + +turf.booleanClockwise(clockwiseRing); +//=true +turf.booleanClockwise(counterClockwiseRing); +//=false +``` + +### Installation + +```javascript +$ npm install @turf/boolean-clockwise + +import { booleanClockwise } from "@turf/boolean-clockwise"; +const result = booleanClockwise(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanClockwise(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanConcave.mdx b/versioned_docs/version-7.0.0/api/booleanConcave.mdx new file mode 100644 index 00000000..1b100dba --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanConcave.mdx @@ -0,0 +1,57 @@ +--- +title: booleanConcave +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a polygon and return true or false as to whether it is concave or not. + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------------------------------------------------------------------------ | --------------- | +| polygon | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | to be evaluated | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var convexPolygon = turf.polygon([ + [ + [0, 0], + [0, 1], + [1, 1], + [1, 0], + [0, 0], + ], +]); + +turf.booleanConcave(convexPolygon); +//=false +``` + +### Installation + +```javascript +$ npm install @turf/boolean-concave + +import { booleanConcave } from "@turf/boolean-concave"; +const result = booleanConcave(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanConcave(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanContains.mdx b/versioned_docs/version-7.0.0/api/booleanContains.mdx new file mode 100644 index 00000000..55249a0f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanContains.mdx @@ -0,0 +1,59 @@ +--- +title: booleanContains +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-contains returns True if the second geometry is completely contained by the first geometry. +The interiors of both geometries must intersect and, the interior and boundary of the secondary (geometry b) +must not intersect the exterior of the primary (geometry a). +Boolean-contains returns the exact opposite result of the `@turf/boolean-within`. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); +var point = turf.point([1, 2]); + +turf.booleanContains(line, point); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-contains + +import { booleanContains } from "@turf/boolean-contains"; +const result = booleanContains(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanContains(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanCrosses.mdx b/versioned_docs/version-7.0.0/api/booleanCrosses.mdx new file mode 100644 index 00000000..ee763d0e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanCrosses.mdx @@ -0,0 +1,64 @@ +--- +title: booleanCrosses +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-Crosses returns True if the intersection results in a geometry whose dimension is one less than +the maximum dimension of the two source geometries and the intersection set is interior to +both source geometries. + +Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestring, linestring/linestring, linestring/polygon, and linestring/multipolygon comparisons. +Other comparisons are not supported as they are outside the OpenGIS Simple Features spec and may give unexpected results. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var line1 = turf.lineString([ + [-2, 2], + [4, 2], +]); +var line2 = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); + +var cross = turf.booleanCrosses(line1, line2); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-crosses + +import { booleanCrosses } from "@turf/boolean-crosses"; +const result = booleanCrosses(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanCrosses(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanDisjoint.mdx b/versioned_docs/version-7.0.0/api/booleanDisjoint.mdx new file mode 100644 index 00000000..80b53860 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanDisjoint.mdx @@ -0,0 +1,56 @@ +--- +title: booleanDisjoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an empty set. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var point = turf.point([2, 2]); +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); + +turf.booleanDisjoint(line, point); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-disjoint + +import { booleanDisjoint } from "@turf/boolean-disjoint"; +const result = booleanDisjoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanDisjoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanEqual.mdx b/versioned_docs/version-7.0.0/api/booleanEqual.mdx new file mode 100644 index 00000000..ef285924 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanEqual.mdx @@ -0,0 +1,57 @@ +--- +title: booleanEqual +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Determine whether two geometries of the same type have identical X,Y coordinate values. +See [http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm](http://edndoc.esri.com/arcsde/9.0/general_topics/understand_spatial_relations.htm) + +### Parameters + +| Name | Type | Description | +| ------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | GeoJSON input | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | GeoJSON input | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.precision? | **number** | decimal precision to use when comparing coordinates _(default 6)_ | + +### Returns + +
    + **boolean** true if the objects are equal, false otherwise + +
+ +### Examples + +```javascript +var pt1 = turf.point([0, 0]); +var pt2 = turf.point([0, 0]); +var pt3 = turf.point([1, 1]); + +turf.booleanEqual(pt1, pt2); +//= true +turf.booleanEqual(pt2, pt3); +//= false +``` + +### Installation + +```javascript +$ npm install @turf/boolean-equal + +import { booleanEqual } from "@turf/boolean-equal"; +const result = booleanEqual(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanEqual(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanIntersects.mdx b/versioned_docs/version-7.0.0/api/booleanIntersects.mdx new file mode 100644 index 00000000..ed889a74 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanIntersects.mdx @@ -0,0 +1,56 @@ +--- +title: booleanIntersects +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-intersects returns (TRUE) two geometries intersect. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var point = turf.point([2, 2]); +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); + +turf.booleanIntersects(line, point); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-intersects + +import { booleanIntersects } from "@turf/boolean-intersects"; +const result = booleanIntersects(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanIntersects(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanOverlap.mdx b/versioned_docs/version-7.0.0/api/booleanOverlap.mdx new file mode 100644 index 00000000..b4ffe434 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanOverlap.mdx @@ -0,0 +1,82 @@ +--- +title: booleanOverlap +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Compares two geometries of the same dimension and returns true if their intersection set results in a geometry +different from both but of the same dimension. It applies to Polygon/Polygon, LineString/LineString, +Multipoint/Multipoint, MultiLineString/MultiLineString and MultiPolygon/MultiPolygon. + +In other words, it returns true if the two geometries overlap, provided that neither completely contains the other. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | input | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | input | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var poly1 = turf.polygon([ + [ + [0, 0], + [0, 5], + [5, 5], + [5, 0], + [0, 0], + ], +]); +var poly2 = turf.polygon([ + [ + [1, 1], + [1, 6], + [6, 6], + [6, 1], + [1, 1], + ], +]); +var poly3 = turf.polygon([ + [ + [10, 10], + [10, 15], + [15, 15], + [15, 10], + [10, 10], + ], +]); + +turf.booleanOverlap(poly1, poly2); +//=true +turf.booleanOverlap(poly2, poly3); +//=false +``` + +### Installation + +```javascript +$ npm install @turf/boolean-overlap + +import { booleanOverlap } from "@turf/boolean-overlap"; +const result = booleanOverlap(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanOverlap(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanParallel.mdx b/versioned_docs/version-7.0.0/api/booleanParallel.mdx new file mode 100644 index 00000000..a30cf984 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanParallel.mdx @@ -0,0 +1,57 @@ +--- +title: booleanParallel +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-Parallel returns True if each segment of `line1` is parallel to the correspondent segment of `line2` + +### Parameters + +| Name | Type | Description | +| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| line1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | GeoJSON Feature or Geometry | +| line2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false if the lines are parallel + +
+ +### Examples + +```javascript +var line1 = turf.lineString([ + [0, 0], + [0, 1], +]); +var line2 = turf.lineString([ + [1, 0], + [1, 1], +]); + +turf.booleanParallel(line1, line2); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-parallel + +import { booleanParallel } from "@turf/boolean-parallel"; +const result = booleanParallel(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanParallel(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanPointInPolygon.mdx b/versioned_docs/version-7.0.0/api/booleanPointInPolygon.mdx new file mode 100644 index 00000000..48c8c8d2 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanPointInPolygon.mdx @@ -0,0 +1,62 @@ +--- +title: booleanPointInPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) or [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) and determines if the point +resides inside the polygon. The polygon can be convex or concave. The function accounts for holes. + +### Parameters + +| Name | Type | Description | +| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | +| point | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | input point | +| polygon | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | input polygon or multipolygon | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.ignoreBoundary? | **boolean** | True if polygon boundary should be ignored when determining if the point is inside the polygon otherwise false. _(default false)_ | + +### Returns + +
    + **boolean** `true` if the Point is inside the Polygon; `false` if the Point is not inside the Polygon + +
+ +### Examples + +```javascript +var pt = turf.point([-77, 44]); +var poly = turf.polygon([ + [ + [-81, 41], + [-81, 47], + [-72, 47], + [-72, 41], + [-81, 41], + ], +]); + +turf.booleanPointInPolygon(pt, poly); +//= true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-point-in-polygon + +import { booleanPointInPolygon } from "@turf/boolean-point-in-polygon"; +const result = booleanPointInPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanPointInPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanPointOnLine.mdx b/versioned_docs/version-7.0.0/api/booleanPointOnLine.mdx new file mode 100644 index 00000000..dcfdbfa1 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanPointOnLine.mdx @@ -0,0 +1,58 @@ +--- +title: booleanPointOnLine +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns true if a point is on a line. Accepts a optional parameter to ignore the +start and end vertices of the linestring. + +### Parameters + +| Name | Type | Description | +| --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | +| pt | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | GeoJSON Point | +| line | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | GeoJSON LineString | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.ignoreEndVertices? | **boolean** | whether to ignore the start and end vertices. _(default false)_ | +| options.epsilon? | **number** | Fractional number to compare with the cross product result. Useful for dealing with floating points such as lng/lat points | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var pt = turf.point([0, 0]); +var line = turf.lineString([ + [-1, -1], + [1, 1], + [1.5, 2.2], +]); +var isPointOnLine = turf.booleanPointOnLine(pt, line); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-point-on-line + +import { booleanPointOnLine } from "@turf/boolean-point-on-line"; +const result = booleanPointOnLine(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanPointOnLine(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanTouches.mdx b/versioned_docs/version-7.0.0/api/booleanTouches.mdx new file mode 100644 index 00000000..59ccdf23 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanTouches.mdx @@ -0,0 +1,57 @@ +--- +title: booleanTouches +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-touches true if none of the points common to both geometries +intersect the interiors of both geometries. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); +var point = turf.point([1, 1]); + +turf.booleanTouches(point, line); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-touches + +import { booleanTouches } from "@turf/boolean-touches"; +const result = booleanTouches(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanTouches(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanValid.mdx b/versioned_docs/version-7.0.0/api/booleanValid.mdx new file mode 100644 index 00000000..1305686f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanValid.mdx @@ -0,0 +1,54 @@ +--- +title: booleanValid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +booleanValid checks if the geometry is a valid according to the OGC Simple Feature Specification. + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); + +turf.booleanValid(line); // => true +turf.booleanValid({ foo: "bar" }); // => false +``` + +### Installation + +```javascript +$ npm install @turf/boolean-valid + +import { booleanValid } from "@turf/boolean-valid"; +const result = booleanValid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanValid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/booleanWithin.mdx b/versioned_docs/version-7.0.0/api/booleanWithin.mdx new file mode 100644 index 00000000..552dca46 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/booleanWithin.mdx @@ -0,0 +1,59 @@ +--- +title: booleanWithin +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Boolean-within returns true if the first geometry is completely within the second geometry. +The interiors of both geometries must intersect and, the interior and boundary of the primary (geometry a) +must not intersect the exterior of the secondary (geometry b). +Boolean-within returns the exact opposite result of the `@turf/boolean-contains`. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------ | --------------------------- | +| feature1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | +| feature2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | GeoJSON Feature or Geometry | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [1, 1], + [1, 2], + [1, 3], + [1, 4], +]); +var point = turf.point([1, 2]); + +turf.booleanWithin(point, line); +//=true +``` + +### Installation + +```javascript +$ npm install @turf/boolean-within + +import { booleanWithin } from "@turf/boolean-within"; +const result = booleanWithin(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.booleanWithin(...); +``` diff --git a/versioned_docs/version-7.0.0/api/buffer.mdx b/versioned_docs/version-7.0.0/api/buffer.mdx new file mode 100644 index 00000000..1569c00e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/buffer.mdx @@ -0,0 +1,74 @@ +--- +title: buffer +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Calculates a buffer for input features for a given radius. Units supported are miles, kilometers, and degrees. + +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 +FeatureCollection, only valid members will be returned in the output +FeatureCollection - i.e., the output collection may have fewer members than +the input, or even be empty. + +### Parameters + +| Name | Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | input to be buffered | +| radius | **number** | distance to draw the buffer (negative values are allowed) | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | any of the options supported by turf units _(default "kilometers")_ | +| options.steps? | **number** | number of steps _(default 8)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> \| undefined** buffered features + +
+ +### Examples + +```javascript +var point = turf.point([-90.54863, 14.616599]); +var buffered = turf.buffer(point, 500, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var point = turf.point([-90.54863, 14.616599]); + var buffered = turf.buffer(point, 500, { units: "miles" }); + + //addToMap + var addToMap = { point, buffered }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/buffer + +import { buffer } from "@turf/buffer"; +const result = buffer(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.buffer(...); +``` diff --git a/versioned_docs/version-7.0.0/api/center.mdx b/versioned_docs/version-7.0.0/api/center.mdx new file mode 100644 index 00000000..a20269f6 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/center.mdx @@ -0,0 +1,80 @@ +--- +title: center +--- + +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) or [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns the absolute center point of all features. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------ | ------------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON to be centered | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | Translate GeoJSON Properties to Point _(default \{\})_ | +| options.bbox? | **Object** | Translate GeoJSON BBox to Point _(default \{\})_ | +| options.id? | **Object** | Translate GeoJSON Id to Point _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** a Point feature at the absolute center point of all input features + +
+ +### Examples + +```javascript +var features = turf.points([ + [-97.522259, 35.4691], + [-97.502754, 35.463455], + [-97.508269, 35.463245], +]); + +var center = turf.center(features); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var features = turf.points([ + [-97.522259, 35.4691], + [-97.502754, 35.463455], + [-97.508269, 35.463245], + ]); + + var center = turf.center(features); + + //addToMap + var addToMap = { features, center }; + center.properties["marker-size"] = "large"; + center.properties["marker-color"] = "#000"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/center + +import { center } from "@turf/center"; +const result = center(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.center(...); +``` diff --git a/versioned_docs/version-7.0.0/api/centerMean.mdx b/versioned_docs/version-7.0.0/api/centerMean.mdx new file mode 100644 index 00000000..a8816f0d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/centerMean.mdx @@ -0,0 +1,83 @@ +--- +title: centerMean +--- + +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) or [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns the mean center. Can be weighted. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------ | ------------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON to be centered | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | Translate GeoJSON Properties to Point _(default \{\})_ | +| options.bbox? | **Object** | Translate GeoJSON BBox to Point _(default \{\})_ | +| options.id? | **Object** | Translate GeoJSON Id to Point _(default \{\})_ | +| options.weight? | **string** | the property name used to weight the center | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** a Point feature at the mean center point of all input features + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([-97.522259, 35.4691], { value: 10 }), + turf.point([-97.502754, 35.463455], { value: 3 }), + turf.point([-97.508269, 35.463245], { value: 5 }), +]); + +var options = { weight: "value" }; +var mean = turf.centerMean(features, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var features = turf.featureCollection([ + turf.point([-97.522259, 35.4691], { value: 10 }), + turf.point([-97.502754, 35.463455], { value: 3 }), + turf.point([-97.508269, 35.463245], { value: 5 }), + ]); + + var options = { weight: "value" }; + var mean = turf.centerMean(features, options); + + //addToMap + var addToMap = { features, mean }; + mean.properties["marker-size"] = "large"; + mean.properties["marker-color"] = "#000"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/center-mean + +import { centerMean } from "@turf/center-mean"; +const result = centerMean(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.centerMean(...); +``` diff --git a/versioned_docs/version-7.0.0/api/centerMedian.mdx b/versioned_docs/version-7.0.0/api/centerMedian.mdx new file mode 100644 index 00000000..1ba0ca72 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/centerMedian.mdx @@ -0,0 +1,113 @@ +--- +title: centerMedian +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of points and calculates the median center, +algorithimically. The median center is understood as the point that is +requires the least total travel from all other points. + +Turfjs has four different functions for calculating the center of a set of +data. Each is useful depending on circumstance. + +`@turf/center` finds the simple center of a dataset, by finding the +midpoint between the extents of the data. That is, it divides in half the +farthest east and farthest west point as well as the farthest north and +farthest south. + +`@turf/center-of-mass` imagines that the dataset is a sheet of paper. +The center of mass is where the sheet would balance on a fingertip. + +`@turf/center-mean` takes the averages of all the coordinates and +produces a value that respects that. Unlike `@turf/center`, it is +sensitive to clusters and outliers. It lands in the statistical middle of a +dataset, not the geographical. It can also be weighted, meaning certain +points are more important than others. + +`@turf/center-median` takes the mean center and tries to find, iteratively, +a new point that requires the least amount of travel from all the points in +the dataset. It is not as sensitive to outliers as `@turf/center-mean`, but it is +attracted to clustered data. It, too, can be weighted. + +**Bibliography** + +Harold W. Kuhn and Robert E. Kuenne, “An Efficient Algorithm for the +Numerical Solution of the Generalized Weber Problem in Spatial +Economics,” _Journal of Regional Science_ 4, no. 2 (1962): 21–33, +doi:[10.1111/j.1467-9787.1962.tb00902.x](https://doi.org/10.1111/j.1467-9787.1962.tb00902.x). + +James E. Burt, Gerald M. Barber, and David L. Rigby, _Elementary +Statistics for Geographers_, 3rd ed., New York: The Guilford +Press, 2009, 150–151. + +### Parameters + +| Name | Type | Description | +| ------------------------- | ------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| features | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\** | Any GeoJSON Feature Collection | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.weight? | **string** | the property name used to weight the center | +| options.tolerance? | **number** | the difference in distance between candidate medians at which point the algorighim stops iterating. _(default 0.001)_ | +| options.counter? | **number** | how many attempts to find the median, should the tolerance be insufficient. _(default 10)_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** The median center of the collection + +
+ +### Examples + +```javascript +var points = turf.points([ + [0, 0], + [1, 0], + [0, 1], + [5, 8], +]); +var medianCenter = turf.centerMedian(points); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var points = turf.points([ + [0, 0], + [1, 0], + [0, 1], + [5, 8], + ]); + var medianCenter = turf.centerMedian(points); + + //addToMap + var addToMap = { points, medianCenter }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/center-median + +import { centerMedian } from "@turf/center-median"; +const result = centerMedian(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.centerMedian(...); +``` diff --git a/versioned_docs/version-7.0.0/api/centerOfMass.mdx b/versioned_docs/version-7.0.0/api/centerOfMass.mdx new file mode 100644 index 00000000..36be1089 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/centerOfMass.mdx @@ -0,0 +1,86 @@ +--- +title: centerOfMass +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes any [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) or a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns its [center of mass](https://en.wikipedia.org/wiki/Center_of_mass) using this formula: [Centroid of Polygon](https://en.wikipedia.org/wiki/Centroid#Centroid_of_polygon). + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------ | ------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON to be centered | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.properties? | **Object** | Translate Properties to Feature _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** the center of mass + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [-81, 41], + [-88, 36], + [-84, 31], + [-80, 33], + [-77, 39], + [-81, 41], + ], +]); + +var center = turf.centerOfMass(polygon); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [-81, 41], + [-88, 36], + [-84, 31], + [-80, 33], + [-77, 39], + [-81, 41], + ], + ]); + + var center = turf.centerOfMass(polygon); + + //addToMap + var addToMap = { polygon, center }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/center-of-mass + +import { centerOfMass } from "@turf/center-of-mass"; +const result = centerOfMass(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.centerOfMass(...); +``` diff --git a/versioned_docs/version-7.0.0/api/centroid.mdx b/versioned_docs/version-7.0.0/api/centroid.mdx new file mode 100644 index 00000000..637b92d3 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/centroid.mdx @@ -0,0 +1,86 @@ +--- +title: centroid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Computes the centroid as the mean of all vertices within the object. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON to be centered | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.properties? | **Object** | an Object that is used as the \{@link Feature\}'s properties _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** the centroid of the input object + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [-81, 41], + [-88, 36], + [-84, 31], + [-80, 33], + [-77, 39], + [-81, 41], + ], +]); + +var centroid = turf.centroid(polygon); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [-81, 41], + [-88, 36], + [-84, 31], + [-80, 33], + [-77, 39], + [-81, 41], + ], + ]); + + var centroid = turf.centroid(polygon); + + //addToMap + var addToMap = { polygon, centroid }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/centroid + +import { centroid } from "@turf/centroid"; +const result = centroid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.centroid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/circle.mdx b/versioned_docs/version-7.0.0/api/circle.mdx new file mode 100644 index 00000000..42f3e213 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/circle.mdx @@ -0,0 +1,73 @@ +--- +title: circle +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and calculates the circle polygon given a radius in degrees, radians, miles, or kilometers; and steps for precision. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- | +| center | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\> \| Array\** | center point | +| radius | **number** | radius of the circle | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.steps? | **number** | number of steps _(default 64)_ | +| options.units? | **string** | miles, kilometers, degrees, or radians _(default 'kilometers')_ | +| options.properties? | **Object** | properties _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** circle polygon + +
+ +### Examples + +```javascript +var center = [-75.343, 39.984]; +var radius = 5; +var options = { steps: 10, units: "kilometers", properties: { foo: "bar" } }; +var circle = turf.circle(center, radius, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var center = [-75.343, 39.984]; + var radius = 5; + var options = { steps: 10, units: "kilometers", properties: { foo: "bar" } }; + var circle = turf.circle(center, radius, options); + + //addToMap + var addToMap = { center: turf.point(center), circle }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/circle + +import { circle } from "@turf/circle"; +const result = circle(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.circle(...); +``` diff --git a/versioned_docs/version-7.0.0/api/cleanCoords.mdx b/versioned_docs/version-7.0.0/api/cleanCoords.mdx new file mode 100644 index 00000000..57062d5b --- /dev/null +++ b/versioned_docs/version-7.0.0/api/cleanCoords.mdx @@ -0,0 +1,66 @@ +--- +title: cleanCoords +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Removes redundant coordinates from any GeoJSON Geometry. + +### Parameters + +| Name | Type | Description | +| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------- | +| geojson | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | Feature or Geometry | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated _(default false)_ | + +### Returns + +
    + **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** the cleaned input Feature/Geometry + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [0, 0], + [0, 2], + [0, 5], + [0, 8], + [0, 8], + [0, 10], +]); +var multiPoint = turf.multiPoint([ + [0, 0], + [0, 0], + [2, 2], +]); + +turf.cleanCoords(line).geometry.coordinates; +//= [[0, 0], [0, 10]] + +turf.cleanCoords(multiPoint).geometry.coordinates; +//= [[0, 0], [2, 2]] +``` + +### Installation + +```javascript +$ npm install @turf/clean-coords + +import { cleanCoords } from "@turf/clean-coords"; +const result = cleanCoords(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.cleanCoords(...); +``` diff --git a/versioned_docs/version-7.0.0/api/clone.mdx b/versioned_docs/version-7.0.0/api/clone.mdx new file mode 100644 index 00000000..34e86b9b --- /dev/null +++ b/versioned_docs/version-7.0.0/api/clone.mdx @@ -0,0 +1,56 @@ +--- +title: clone +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns a cloned copy of the passed GeoJSON Object, including possible 'Foreign Members'. +~3-5x faster than the common JSON.parse + JSON.stringify combo method. + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | -------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON Object | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** cloned GeoJSON Object + +
+ +### Examples + +```javascript +var line = turf.lineString( + [ + [-74, 40], + [-78, 42], + [-82, 35], + ], + { color: "red" }, +); + +var lineCloned = turf.clone(line); +``` + +### Installation + +```javascript +$ npm install @turf/clone + +import { clone } from "@turf/clone"; +const result = clone(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.clone(...); +``` diff --git a/versioned_docs/version-7.0.0/api/clusterEach.mdx b/versioned_docs/version-7.0.0/api/clusterEach.mdx new file mode 100644 index 00000000..711af2ed --- /dev/null +++ b/versioned_docs/version-7.0.0/api/clusterEach.mdx @@ -0,0 +1,77 @@ +--- +title: clusterEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +clusterEach + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------ | --------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** | GeoJSON Features | +| property | **string \| number** | GeoJSON property key/value used to create clusters | +| callback | **Function** | a method that takes (cluster, clusterValue, currentIndex) | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var geojson = turf.featureCollection([ + turf.point([0, 0]), + turf.point([2, 4]), + turf.point([3, 6]), + turf.point([5, 1]), + turf.point([4, 2]), +]); + +// Create a cluster using K-Means (adds `cluster` to GeoJSON properties) +var clustered = turf.clustersKmeans(geojson); + +// Iterate over each cluster +turf.clusterEach( + clustered, + "cluster", + function (cluster, clusterValue, currentIndex) { + //= cluster + //= clusterValue + //= currentIndex + }, +); + +// Calculate the total number of clusters +var total = 0; +turf.clusterEach(clustered, "cluster", function () { + total++; +}); + +// Create an Array of all the values retrieved from the 'cluster' property +var values = []; +turf.clusterEach(clustered, "cluster", function (cluster, clusterValue) { + values.push(clusterValue); +}); +``` + +### Installation + +```javascript +$ npm install @turf/clusters + +import { clusterEach } from "@turf/clusters"; +const result = clusterEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.clusterEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/clusterReduce.mdx b/versioned_docs/version-7.0.0/api/clusterReduce.mdx new file mode 100644 index 00000000..fb8192ec --- /dev/null +++ b/versioned_docs/version-7.0.0/api/clusterReduce.mdx @@ -0,0 +1,93 @@ +--- +title: clusterReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce clusters in GeoJSON Features, similar to Array.reduce() + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------ | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** | GeoJSON Features | +| property | **string \| number** | GeoJSON property key/value used to create clusters | +| callback | **Function** | a method that takes (previousValue, cluster, clusterValue, currentIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var geojson = turf.featureCollection([ + turf.point([0, 0]), + turf.point([2, 4]), + turf.point([3, 6]), + turf.point([5, 1]), + turf.point([4, 2]), +]); + +// Create a cluster using K-Means (adds `cluster` to GeoJSON properties) +var clustered = turf.clustersKmeans(geojson); + +// Iterate over each cluster and perform a calculation +var initialValue = 0; +turf.clusterReduce( + clustered, + "cluster", + function (previousValue, cluster, clusterValue, currentIndex) { + //=previousValue + //=cluster + //=clusterValue + //=currentIndex + return previousValue++; + }, + initialValue, +); + +// Calculate the total number of clusters +var total = turf.clusterReduce( + clustered, + "cluster", + function (previousValue) { + return previousValue++; + }, + 0, +); + +// Create an Array of all the values retrieved from the 'cluster' property +var values = turf.clusterReduce( + clustered, + "cluster", + function (previousValue, cluster, clusterValue) { + return previousValue.concat(clusterValue); + }, + [], +); +``` + +### Installation + +```javascript +$ npm install @turf/clusters + +import { clusterReduce } from "@turf/clusters"; +const result = clusterReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.clusterReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/clustersDbscan.mdx b/versioned_docs/version-7.0.0/api/clustersDbscan.mdx new file mode 100644 index 00000000..b73c325f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/clustersDbscan.mdx @@ -0,0 +1,76 @@ +--- +title: clustersDbscan +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and partition them into clusters according to [https://en.wikipedia.org/wiki/DBSCAN](DBSCAN's) data clustering algorithm. + +### Parameters + +| Name | Type | Description | +| ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | to be clustered | +| maxDistance | **number** | Maximum Distance between any point of the cluster to generate the clusters (kilometers only) | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers _(default "kilometers")_ | +| options.mutate? | **boolean** | Allows GeoJSON input to be mutated _(default false)_ | +| options.minPoints? | **number** | Minimum number of points to generate a single cluster, points which do not meet this requirement will be classified as an 'edge' or 'noise'. _(default 3)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** 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') + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + // 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/clusters-dbscan + +import { clustersDbscan } from "@turf/clusters-dbscan"; +const result = clustersDbscan(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.clustersDbscan(...); +``` diff --git a/versioned_docs/version-7.0.0/api/clustersKmeans.mdx b/versioned_docs/version-7.0.0/api/clustersKmeans.mdx new file mode 100644 index 00000000..963f9e2a --- /dev/null +++ b/versioned_docs/version-7.0.0/api/clustersKmeans.mdx @@ -0,0 +1,75 @@ +--- +title: clustersKmeans +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and partition them into clusters using the k-mean . +It uses the [k-means algorithm](https://en.wikipedia.org/wiki/K-means_clustering) + +### Parameters + +| Name | Type | Description | +| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | to be clustered | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.numberOfClusters? | **number** | numberOfClusters that will be generated _(default Math.sqrt(numberOfPoints/2))_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** 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] + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + // 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/clusters-kmeans + +import { clustersKmeans } from "@turf/clusters-kmeans"; +const result = clustersKmeans(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.clustersKmeans(...); +``` diff --git a/versioned_docs/version-7.0.0/api/collect.mdx b/versioned_docs/version-7.0.0/api/collect.mdx new file mode 100644 index 00000000..3953dbd2 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/collect.mdx @@ -0,0 +1,123 @@ +--- +title: collect +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +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 + +| Name | Type | Description | +| ----------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ | +| polygons | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | polygons with values on which to aggregate | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | points to be aggregated | +| inProperty | **string** | property to be nested from | +| outProperty | **string** | property to be nested into | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** polygons with properties listed based on `outField` + +
+ +### 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] +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/collect + +import { collect } from "@turf/collect"; +const result = collect(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.collect(...); +``` diff --git a/versioned_docs/version-7.0.0/api/collectionOf.mdx b/versioned_docs/version-7.0.0/api/collectionOf.mdx new file mode 100644 index 00000000..b4049c69 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/collectionOf.mdx @@ -0,0 +1,38 @@ +--- +title: collectionOf +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Enforce expectations about types of [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) inputs for Turf. +Internally this uses [geojsonType](geojsonType) to judge geometry types. + +### Parameters + +| Name | Type | Description | +| ----------------- | ------------------------------------------------------------------------ | ----------------------------------------------------- | +| featureCollection | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** | a FeatureCollection for which features will be judged | +| type | **string** | expected GeoJSON type | +| name | **string** | name of calling function | + +### Returns + +### Installation + +```javascript +$ npm install @turf/invariant + +import { collectionOf } from "@turf/invariant"; +const result = collectionOf(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.collectionOf(...); +``` diff --git a/versioned_docs/version-7.0.0/api/combine.mdx b/versioned_docs/version-7.0.0/api/combine.mdx new file mode 100644 index 00000000..ac2c8e72 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/combine.mdx @@ -0,0 +1,73 @@ +--- +title: combine +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Combines a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2), [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4), or [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) features +into [MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3), [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5), or [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) features. + +### Parameters + +| Name | Type | Description | +| ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | +| fc | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) \| [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | a FeatureCollection of any type | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3) \| [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** a FeatureCollection of corresponding type to input + +
+ +### Examples + +```javascript +var fc = turf.featureCollection([ + turf.point([19.026432, 47.49134]), + turf.point([19.074497, 47.509548]), +]); + +var combined = turf.combine(fc); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/combine + +import { combine } from "@turf/combine"; +const result = combine(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.combine(...); +``` diff --git a/versioned_docs/version-7.0.0/api/concave.mdx b/versioned_docs/version-7.0.0/api/concave.mdx new file mode 100644 index 00000000..51cb1a71 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/concave.mdx @@ -0,0 +1,86 @@ +--- +title: concave +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and returns a concave hull Polygon or MultiPolygon. +Internally, this uses [turf-tin](https://github.com/Turfjs/turf-tin) to generate geometries. + +### Parameters + +| Name | Type | Description | +| ----------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | input points | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.maxEdge? | **number** | the length (in 'units') of an edge necessary for part of the hull to become concave. _(default Infinity)_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> \| null** a concave hull (null value is returned if unable to compute hull) + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/concave + +import { concave } from "@turf/concave"; +const result = concave(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.concave(...); +``` diff --git a/versioned_docs/version-7.0.0/api/containsNumber.mdx b/versioned_docs/version-7.0.0/api/containsNumber.mdx new file mode 100644 index 00000000..96efae80 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/containsNumber.mdx @@ -0,0 +1,40 @@ +--- +title: containsNumber +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Checks if coordinates contains a number + +### Parameters + +| Name | Type | Description | +| ----------- | ---------------- | ------------------- | +| coordinates | **Array\** | GeoJSON Coordinates | + +### Returns + +
    + **boolean** true if Array contains a number + +
+ +### Installation + +```javascript +$ npm install @turf/invariant + +import { containsNumber } from "@turf/invariant"; +const result = containsNumber(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.containsNumber(...); +``` diff --git a/versioned_docs/version-7.0.0/api/convertArea.mdx b/versioned_docs/version-7.0.0/api/convertArea.mdx new file mode 100644 index 00000000..d4417d7e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/convertArea.mdx @@ -0,0 +1,43 @@ +--- +title: convertArea +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts a area to the requested unit. +Valid units: kilometers, kilometres, meters, metres, centimetres, millimeters, acres, miles, yards, feet, inches, hectares + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | -------------------------------------- | +| area | **number** | to be converted | +| originalUnit? | **Units** | of the distance _(default "meters")_ | +| finalUnit? | **Units** | returned unit _(default "kilometers")_ | + +### Returns + +
    + **number** the converted area + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { convertArea } from "@turf/helpers"; +const result = convertArea(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.convertArea(...); +``` diff --git a/versioned_docs/version-7.0.0/api/convertLength.mdx b/versioned_docs/version-7.0.0/api/convertLength.mdx new file mode 100644 index 00000000..bbe82674 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/convertLength.mdx @@ -0,0 +1,43 @@ +--- +title: convertLength +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts a length to the requested unit. +Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | -------------------------------------- | +| length | **number** | to be converted | +| originalUnit? | **Units** | of the length _(default "kilometers")_ | +| finalUnit? | **Units** | returned unit _(default "kilometers")_ | + +### Returns + +
    + **number** the converted length + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { convertLength } from "@turf/helpers"; +const result = convertLength(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.convertLength(...); +``` diff --git a/versioned_docs/version-7.0.0/api/convex.mdx b/versioned_docs/version-7.0.0/api/convex.mdx new file mode 100644 index 00000000..f83b0785 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/convex.mdx @@ -0,0 +1,87 @@ +--- +title: convex +--- + +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) or a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns a convex hull [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6). + +Internally this uses +the [convex-hull](https://github.com/mikolalysenko/convex-hull) module that implements a +[monotone chain hull](http://en.wikibooks.org/wiki/Algorithm_Implementation/Geometry/Convex_hull/Monotone_chain). + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input Feature or FeatureCollection | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.concavity? | **number** | 1 - thin shape. Infinity - convex hull. _(default Infinity)_ | +| options.properties? | **Object** | Translate Properties to Feature _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a convex hull + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/convex + +import { convex } from "@turf/convex"; +const result = convex(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.convex(...); +``` diff --git a/versioned_docs/version-7.0.0/api/coordAll.mdx b/versioned_docs/version-7.0.0/api/coordAll.mdx new file mode 100644 index 00000000..0751ff73 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/coordAll.mdx @@ -0,0 +1,52 @@ +--- +title: coordAll +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Get all coordinates from any GeoJSON object. + +### Parameters + +| Name | Type | Description | +| ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | + +### Returns + +
    + **Array\\>** coordinate position array + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +var coords = turf.coordAll(features); +//= [[26, 37], [36, 53]] +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { coordAll } from "@turf/meta"; +const result = coordAll(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.coordAll(...); +``` diff --git a/versioned_docs/version-7.0.0/api/coordEach.mdx b/versioned_docs/version-7.0.0/api/coordEach.mdx new file mode 100644 index 00000000..0e5c1fe5 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/coordEach.mdx @@ -0,0 +1,65 @@ +--- +title: coordEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over coordinates in any GeoJSON object, similar to Array.forEach() + +### Parameters + +| Name | Type | Description | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (currentCoord, coordIndex, featureIndex, multiFeatureIndex) | +| excludeWrapCoord? | **boolean** | whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. _(default false)_ | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.coordEach( + features, + function ( + currentCoord, + coordIndex, + featureIndex, + multiFeatureIndex, + geometryIndex, + ) { + //=currentCoord + //=coordIndex + //=featureIndex + //=multiFeatureIndex + //=geometryIndex + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { coordEach } from "@turf/meta"; +const result = coordEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.coordEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/coordReduce.mdx b/versioned_docs/version-7.0.0/api/coordReduce.mdx new file mode 100644 index 00000000..b59d720e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/coordReduce.mdx @@ -0,0 +1,72 @@ +--- +title: coordReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce coordinates in any GeoJSON object, similar to Array.reduce() + +### Parameters + +| Name | Type | Description | +| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | any GeoJSON object | +| callback | **Function** | a method that takes (previousValue, currentCoord, coordIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | +| excludeWrapCoord? | **boolean** | whether or not to include the final coordinate of LinearRings that wraps the ring in its iteration. _(default false)_ | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.coordReduce( + features, + function ( + previousValue, + currentCoord, + coordIndex, + featureIndex, + multiFeatureIndex, + geometryIndex, + ) { + //=previousValue + //=currentCoord + //=coordIndex + //=featureIndex + //=multiFeatureIndex + //=geometryIndex + return currentCoord; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { coordReduce } from "@turf/meta"; +const result = coordReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.coordReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/degreesToRadians.mdx b/versioned_docs/version-7.0.0/api/degreesToRadians.mdx new file mode 100644 index 00000000..76debaaa --- /dev/null +++ b/versioned_docs/version-7.0.0/api/degreesToRadians.mdx @@ -0,0 +1,40 @@ +--- +title: degreesToRadians +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts an angle in degrees to radians + +### Parameters + +| Name | Type | Description | +| ------- | ---------- | ------------------------------- | +| degrees | **number** | angle between 0 and 360 degrees | + +### Returns + +
    + **number** angle in radians + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { degreesToRadians } from "@turf/helpers"; +const result = degreesToRadians(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.degreesToRadians(...); +``` diff --git a/versioned_docs/version-7.0.0/api/destination.mdx b/versioned_docs/version-7.0.0/api/destination.mdx new file mode 100644 index 00000000..6a5b03a8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/destination.mdx @@ -0,0 +1,81 @@ +--- +title: destination +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) 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](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature. + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | +| origin | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | starting point | +| distance | **number** | distance from the origin point | +| bearing | **number** | ranging from -180 to 180 | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | miles, kilometers, degrees, or radians _(default 'kilometers')_ | +| options.properties? | **Object** | Translate properties to Point _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** destination point + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/destination + +import { destination } from "@turf/destination"; +const result = destination(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.destination(...); +``` diff --git a/versioned_docs/version-7.0.0/api/difference.mdx b/versioned_docs/version-7.0.0/api/difference.mdx new file mode 100644 index 00000000..a073e852 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/difference.mdx @@ -0,0 +1,126 @@ +--- +title: difference +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Finds the difference between multiple [polygons](https://tools.ietf.org/html/rfc7946#section-3.1.6) by clipping the subsequent polygon from the first. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- | +| features | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | input Polygon features | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> \| null** a Polygon or MultiPolygon feature showing the area of `polygon1` excluding the area of `polygon2` (if empty returns `null`) + +
+ +### 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(turf.featureCollection([polygon1, polygon2])); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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( + turf.featureCollection([polygon1, polygon2]), + ); + + //addToMap + var addToMap = { polygon1, polygon2, difference }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/difference + +import { difference } from "@turf/difference"; +const result = difference(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.difference(...); +``` diff --git a/versioned_docs/version-7.0.0/api/directionalMean.mdx b/versioned_docs/version-7.0.0/api/directionalMean.mdx new file mode 100644 index 00000000..21092328 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/directionalMean.mdx @@ -0,0 +1,62 @@ +--- +title: directionalMean +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +This module calculate the average angle of a set of lines, measuring the trend of it. +It can be used in both project coordinate system and geography coordinate system. +It can handle segments of line or the whole line. + +### Parameters + +| Name | Type | Description | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| lines | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | | +| options? | **object** | _(default \{\})_ | +| options.planar? | **boolean** | whether the spatial reference system is projected or geographical. _(default true)_ | +| options.segment? | **boolean** | whether treat a LineString as a whole or a set of segments. _(default false)_ | + +### Returns + +
    + **DirectionalMeanLine** Directional Mean Line + +
+ +### Examples + +```javascript +var lines = turf.lineStrings([ + [ + [110, 45], + [120, 50], + ], + [ + [100, 50], + [115, 55], + ], +]); +var directionalMeanLine = turf.directionalMean(lines); +// => directionalMeanLine +``` + +### Installation + +```javascript +$ npm install @turf/directional-mean + +import { directionalMean } from "@turf/directional-mean"; +const result = directionalMean(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.directionalMean(...); +``` diff --git a/versioned_docs/version-7.0.0/api/dissolve.mdx b/versioned_docs/version-7.0.0/api/dissolve.mdx new file mode 100644 index 00000000..7428470d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/dissolve.mdx @@ -0,0 +1,143 @@ +--- +title: dissolve +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Dissolves a FeatureCollection of [polygon](polygon) features, filtered by an optional property name:value. +Note that [mulitpolygon](mulitpolygon) features within the collection are not supported + +### Parameters + +| Name | Type | Description | +| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | +| featureCollection | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | input feature collection to be dissolved | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.propertyName? | **string** | features with the same `propertyName` value will be dissolved. | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a FeatureCollection containing the dissolved polygons + +
+ +### 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" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/dissolve + +import { dissolve } from "@turf/dissolve"; +const result = dissolve(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.dissolve(...); +``` diff --git a/versioned_docs/version-7.0.0/api/distance.mdx b/versioned_docs/version-7.0.0/api/distance.mdx new file mode 100644 index 00000000..6f22f019 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/distance.mdx @@ -0,0 +1,76 @@ +--- +title: distance +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Calculates the distance between two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) in degrees, radians, miles, or kilometers. +This uses the [Haversine formula](http://en.wikipedia.org/wiki/Haversine_formula) to account for global curvature. + +### Parameters + +| Name | Type | Description | +| --------------------- | ---------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| from | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1) \| [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)** | origin point or coordinate | +| to | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1) \| [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)** | destination point or coordinate | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | + +### Returns + +
    + **number** distance between the two points + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/distance + +import { distance } from "@turf/distance"; +const result = distance(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.distance(...); +``` diff --git a/versioned_docs/version-7.0.0/api/distanceWeight.mdx b/versioned_docs/version-7.0.0/api/distanceWeight.mdx new file mode 100644 index 00000000..1764cfd3 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/distanceWeight.mdx @@ -0,0 +1,52 @@ +--- +title: distanceWeight +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +### Parameters + +| Name | Type | Description | +| ------------------------------- | ------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | +| fc | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\** | FeatureCollection. | +| options? | **Object** | option object. | +| options.threshold? | **number** | If the distance between neighbor and target features is greater than threshold, the weight of that neighbor is 0. _(default 10000)_ | +| options.p? | **number** | Minkowski p-norm distance parameter. 1: Manhattan distance. 2: Euclidean distance. 1=\? | **boolean** | If true, weight=1 if d \<= threshold otherwise weight=0. If false, weight=Math.pow(d, alpha). _(default false)_ | +| options.alpha? | **number** | distance decay parameter. A big value means the weight decay quickly as distance increases. _(default -1)_ | +| options.standardization? | **boolean** | row standardization. _(default false)_ | + +### Returns + +
    + **Array\\>** distance weight matrix. + +
+ +### Examples + +```javascript +var bbox = [-65, 40, -63, 42]; +var dataset = turf.randomPoint(100, { bbox: bbox }); +var result = turf.distanceWeight(dataset); +``` + +### Installation + +```javascript +$ npm install @turf/distance-weight + +import { distanceWeight } from "@turf/distance-weight"; +const result = distanceWeight(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.distanceWeight(...); +``` diff --git a/versioned_docs/version-7.0.0/api/ellipse.mdx b/versioned_docs/version-7.0.0/api/ellipse.mdx new file mode 100644 index 00000000..9f47e136 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/ellipse.mdx @@ -0,0 +1,76 @@ +--- +title: ellipse +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision. + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- | +| center | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | center point | +| xSemiAxis | **number** | semi (major) axis of the ellipse along the x-axis | +| ySemiAxis | **number** | semi (minor) axis of the ellipse along the y-axis | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.angle? | **number** | angle of rotation in decimal degrees, positive clockwise _(default 0)_ | +| options.pivot? | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | point around which any rotation will be performed _(default center)_ | +| options.steps? | **number** | number of steps _(default 64)_ | +| options.units? | **string** | unit of measurement for axes _(default 'kilometers')_ | +| options.properties? | **Object** | properties _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** ellipse polygon + +
+ +### Examples + +```javascript +var center = [-75, 40]; +var xSemiAxis = 5; +var ySemiAxis = 2; +var ellipse = turf.ellipse(center, xSemiAxis, ySemiAxis); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var center = [-75, 40]; + var xSemiAxis = 5; + var ySemiAxis = 2; + var ellipse = turf.ellipse(center, xSemiAxis, ySemiAxis); + + //addToMap + var addToMap = { center: turf.point(center), ellipse }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/ellipse + +import { ellipse } from "@turf/ellipse"; +const result = ellipse(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.ellipse(...); +``` diff --git a/versioned_docs/version-7.0.0/api/envelope.mdx b/versioned_docs/version-7.0.0/api/envelope.mdx new file mode 100644 index 00000000..38946c08 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/envelope.mdx @@ -0,0 +1,74 @@ +--- +title: envelope +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes any number of features and returns a rectangular [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) that encompasses all vertices. + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | -------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input features | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a rectangular Polygon feature that encompasses all vertices + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/envelope + +import { envelope } from "@turf/envelope"; +const result = envelope(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.envelope(...); +``` diff --git a/versioned_docs/version-7.0.0/api/explode.mdx b/versioned_docs/version-7.0.0/api/explode.mdx new file mode 100644 index 00000000..d561d368 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/explode.mdx @@ -0,0 +1,84 @@ +--- +title: explode +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a feature or set of features and returns all positions as [points](https://tools.ietf.org/html/rfc7946#section-3.1.2). + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | -------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input features | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\** points representing the exploded 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/explode + +import { explode } from "@turf/explode"; +const result = explode(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.explode(...); +``` diff --git a/versioned_docs/version-7.0.0/api/feature.mdx b/versioned_docs/version-7.0.0/api/feature.mdx new file mode 100644 index 00000000..9e5e29d3 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/feature.mdx @@ -0,0 +1,57 @@ +--- +title: feature +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Wraps a GeoJSON [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) in a GeoJSON [Feature](https://tools.ietf.org/html/rfc7946#section-3.2). + +### Parameters + +| Name | Type | Description | +| -------------------- | --------------------------------------------------------------- | ------------------------------------------------------------------------- | +| geometry | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | input geometry | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** a GeoJSON Feature + +
+ +### Examples + +```javascript +var geometry = { + type: "Point", + coordinates: [110, 50], +}; + +var feature = turf.feature(geometry); + +//=feature +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { feature } from "@turf/helpers"; +const result = feature(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.feature(...); +``` diff --git a/versioned_docs/version-7.0.0/api/featureCollection.mdx b/versioned_docs/version-7.0.0/api/featureCollection.mdx new file mode 100644 index 00000000..88aa5cd9 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/featureCollection.mdx @@ -0,0 +1,55 @@ +--- +title: featureCollection +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes one or more [Features](https://tools.ietf.org/html/rfc7946#section-3.2) and creates a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3). + +### Parameters + +| Name | Type | Description | +| -------------------- | ----------------------------------------------------------------------- | ------------------------------------------------------------------------- | +| features | **Array\<[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\>** | input features | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** FeatureCollection of Features + +
+ +### Examples + +```javascript +var locationA = turf.point([-75.343, 39.984], { name: "Location A" }); +var locationB = turf.point([-75.833, 39.284], { name: "Location B" }); +var locationC = turf.point([-75.534, 39.123], { name: "Location C" }); + +var collection = turf.featureCollection([locationA, locationB, locationC]); + +//=collection +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { featureCollection } from "@turf/helpers"; +const result = featureCollection(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.featureCollection(...); +``` diff --git a/versioned_docs/version-7.0.0/api/featureEach.mdx b/versioned_docs/version-7.0.0/api/featureEach.mdx new file mode 100644 index 00000000..f5dcd8a8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/featureEach.mdx @@ -0,0 +1,53 @@ +--- +title: featureEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over features in any GeoJSON object, similar to +Array.forEach. + +### Parameters + +| Name | Type | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (currentFeature, featureIndex) | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.featureEach(features, function (currentFeature, featureIndex) { + //=currentFeature + //=featureIndex +}); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { featureEach } from "@turf/meta"; +const result = featureEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.featureEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/featureOf.mdx b/versioned_docs/version-7.0.0/api/featureOf.mdx new file mode 100644 index 00000000..c4bbf3d9 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/featureOf.mdx @@ -0,0 +1,38 @@ +--- +title: featureOf +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Enforce expectations about types of [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) inputs for Turf. +Internally this uses [geojsonType](geojsonType) to judge geometry types. + +### Parameters + +| Name | Type | Description | +| ------- | -------------------------------------------------------------- | ---------------------------------------- | +| feature | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | a feature with an expected geometry type | +| type | **string** | expected GeoJSON type | +| name | **string** | name of calling function | + +### Returns + +### Installation + +```javascript +$ npm install @turf/invariant + +import { featureOf } from "@turf/invariant"; +const result = featureOf(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.featureOf(...); +``` diff --git a/versioned_docs/version-7.0.0/api/featureReduce.mdx b/versioned_docs/version-7.0.0/api/featureReduce.mdx new file mode 100644 index 00000000..8280888d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/featureReduce.mdx @@ -0,0 +1,61 @@ +--- +title: featureReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce features in any GeoJSON object, similar to Array.reduce(). + +### Parameters + +| Name | Type | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (previousValue, currentFeature, featureIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.featureReduce( + features, + function (previousValue, currentFeature, featureIndex) { + //=previousValue + //=currentFeature + //=featureIndex + return currentFeature; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { featureReduce } from "@turf/meta"; +const result = featureReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.featureReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/findPoint.mdx b/versioned_docs/version-7.0.0/api/findPoint.mdx new file mode 100644 index 00000000..79afbf8b --- /dev/null +++ b/versioned_docs/version-7.0.0/api/findPoint.mdx @@ -0,0 +1,79 @@ +--- +title: findPoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Finds a particular Point from a GeoJSON using `@turf/meta` indexes. + +Negative indexes are permitted. + +### Parameters + +| Name | Type | Description | +| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | Any GeoJSON Feature or Geometry | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.featureIndex? | **number** | Feature Index _(default 0)_ | +| options.multiFeatureIndex? | **number** | Multi-Feature Index _(default 0)_ | +| options.geometryIndex? | **number** | Geometry Index _(default 0)_ | +| options.coordIndex? | **number** | Coord Index _(default 0)_ | +| options.properties? | **Object** | Translate Properties to output Point _(default \{\})_ | +| options.bbox? | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | Translate BBox to output Point _(default \{\})_ | +| options.id? | **number \| string** | Translate Id to output Point _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** 2-vertex GeoJSON Feature Point + +
+ +### Examples + +```javascript +var multiLine = turf.multiLineString([ + [ + [10, 10], + [50, 30], + [30, 40], + ], + [ + [-10, -10], + [-50, -30], + [-30, -40], + ], +]); + +// First Segment (defaults are 0) +turf.findPoint(multiLine); +// => Feature> + +// First Segment of the 2nd Multi-Feature +turf.findPoint(multiLine, { multiFeatureIndex: 1 }); +// => Feature> + +// Last Segment of last Multi-Feature +turf.findPoint(multiLine, { multiFeatureIndex: -1, coordIndex: -1 }); +// => Feature> +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { findPoint } from "@turf/meta"; +const result = findPoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.findPoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/findSegment.mdx b/versioned_docs/version-7.0.0/api/findSegment.mdx new file mode 100644 index 00000000..30ef8dfb --- /dev/null +++ b/versioned_docs/version-7.0.0/api/findSegment.mdx @@ -0,0 +1,80 @@ +--- +title: findSegment +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Finds a particular 2-vertex LineString Segment from a GeoJSON using `@turf/meta` indexes. + +Negative indexes are permitted. +Point & MultiPoint will always return null. + +### Parameters + +| Name | Type | Description | +| --------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | Any GeoJSON Feature or Geometry | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.featureIndex? | **number** | Feature Index _(default 0)_ | +| options.multiFeatureIndex? | **number** | Multi-Feature Index _(default 0)_ | +| options.geometryIndex? | **number** | Geometry Index _(default 0)_ | +| options.segmentIndex? | **number** | Segment Index _(default 0)_ | +| options.properties? | **Object** | Translate Properties to output LineString _(default \{\})_ | +| options.bbox? | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | Translate BBox to output LineString _(default \{\})_ | +| options.id? | **number \| string** | Translate Id to output LineString _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** 2-vertex GeoJSON Feature LineString + +
+ +### Examples + +```javascript +var multiLine = turf.multiLineString([ + [ + [10, 10], + [50, 30], + [30, 40], + ], + [ + [-10, -10], + [-50, -30], + [-30, -40], + ], +]); + +// First Segment (defaults are 0) +turf.findSegment(multiLine); +// => Feature> + +// First Segment of 2nd Multi Feature +turf.findSegment(multiLine, { multiFeatureIndex: 1 }); +// => Feature> + +// Last Segment of Last Multi Feature +turf.findSegment(multiLine, { multiFeatureIndex: -1, segmentIndex: -1 }); +// => Feature> +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { findSegment } from "@turf/meta"; +const result = findSegment(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.findSegment(...); +``` diff --git a/versioned_docs/version-7.0.0/api/flatten.mdx b/versioned_docs/version-7.0.0/api/flatten.mdx new file mode 100644 index 00000000..b65a6600 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/flatten.mdx @@ -0,0 +1,118 @@ +--- +title: flatten +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Flattens any [GeoJSON](https://tools.ietf.org/html/rfc7946#section-3) to a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) inspired by [geojson-flatten](https://github.com/tmcw/geojson-flatten). + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | ------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any valid GeoJSON Object | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\** all Multi-Geometries are flattened into single Features + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/flatten + +import { flatten } from "@turf/flatten"; +const result = flatten(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.flatten(...); +``` diff --git a/versioned_docs/version-7.0.0/api/flattenEach.mdx b/versioned_docs/version-7.0.0/api/flattenEach.mdx new file mode 100644 index 00000000..1a2bb5a4 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/flattenEach.mdx @@ -0,0 +1,61 @@ +--- +title: flattenEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over flattened features in any GeoJSON object, similar to +Array.forEach. + +### Parameters + +| Name | Type | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (currentFeature, featureIndex, multiFeatureIndex) | + +### Returns + +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.multiPoint( + [ + [40, 30], + [36, 53], + ], + { hello: "world" }, + ), +]); + +turf.flattenEach( + features, + function (currentFeature, featureIndex, multiFeatureIndex) { + //=currentFeature + //=featureIndex + //=multiFeatureIndex + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { flattenEach } from "@turf/meta"; +const result = flattenEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.flattenEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/flattenReduce.mdx b/versioned_docs/version-7.0.0/api/flattenReduce.mdx new file mode 100644 index 00000000..4f1d80dd --- /dev/null +++ b/versioned_docs/version-7.0.0/api/flattenReduce.mdx @@ -0,0 +1,68 @@ +--- +title: flattenReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce flattened features in any GeoJSON object, similar to Array.reduce(). + +### Parameters + +| Name | Type | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (previousValue, currentFeature, featureIndex, multiFeatureIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.multiPoint( + [ + [40, 30], + [36, 53], + ], + { hello: "world" }, + ), +]); + +turf.flattenReduce( + features, + function (previousValue, currentFeature, featureIndex, multiFeatureIndex) { + //=previousValue + //=currentFeature + //=featureIndex + //=multiFeatureIndex + return currentFeature; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { flattenReduce } from "@turf/meta"; +const result = flattenReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.flattenReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/flip.mdx b/versioned_docs/version-7.0.0/api/flip.mdx new file mode 100644 index 00000000..8dfb19dc --- /dev/null +++ b/versioned_docs/version-7.0.0/api/flip.mdx @@ -0,0 +1,68 @@ +--- +title: flip +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes input features and flips all of their coordinates from `[x, y]` to `[y, x]`. + +### Parameters + +| Name | Type | Description | +| ---------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input features | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** a feature or set of features of the same type as `input` with flipped coordinates + +
+ +### Examples + +```javascript +var serbia = turf.point([20.566406, 43.421008]); + +var saudiArabia = turf.flip(serbia); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var serbia = turf.point([20.566406, 43.421008]); + + var saudiArabia = turf.flip(serbia); + + //addToMap + var addToMap = { serbia, saudiArabia }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/flip + +import { flip } from "@turf/flip"; +const result = flip(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.flip(...); +``` diff --git a/versioned_docs/version-7.0.0/api/geojsonType.mdx b/versioned_docs/version-7.0.0/api/geojsonType.mdx new file mode 100644 index 00000000..d342fa07 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/geojsonType.mdx @@ -0,0 +1,37 @@ +--- +title: geojsonType +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Enforce expectations about types of GeoJSON objects for Turf. + +### Parameters + +| Name | Type | Description | +| ----- | ------------------------------------------------------------ | ------------------------ | +| value | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any GeoJSON object | +| type | **string** | expected GeoJSON type | +| name | **string** | name of calling function | + +### Returns + +### Installation + +```javascript +$ npm install @turf/invariant + +import { geojsonType } from "@turf/invariant"; +const result = geojsonType(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.geojsonType(...); +``` diff --git a/versioned_docs/version-7.0.0/api/geomEach.mdx b/versioned_docs/version-7.0.0/api/geomEach.mdx new file mode 100644 index 00000000..9a073c2d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/geomEach.mdx @@ -0,0 +1,64 @@ +--- +title: geomEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over each geometry in any GeoJSON object, similar to Array.forEach() + +### Parameters + +| Name | Type | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.geomEach( + features, + function ( + currentGeometry, + featureIndex, + featureProperties, + featureBBox, + featureId, + ) { + //=currentGeometry + //=featureIndex + //=featureProperties + //=featureBBox + //=featureId + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { geomEach } from "@turf/meta"; +const result = geomEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.geomEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/geomReduce.mdx b/versioned_docs/version-7.0.0/api/geomReduce.mdx new file mode 100644 index 00000000..101034a8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/geomReduce.mdx @@ -0,0 +1,71 @@ +--- +title: geomReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce geometry in any GeoJSON object, similar to Array.reduce(). + +### Parameters + +| Name | Type | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON object | +| callback | **Function** | a method that takes (previousValue, currentGeometry, featureIndex, featureProperties, featureBBox, featureId) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.geomReduce( + features, + function ( + previousValue, + currentGeometry, + featureIndex, + featureProperties, + featureBBox, + featureId, + ) { + //=previousValue + //=currentGeometry + //=featureIndex + //=featureProperties + //=featureBBox + //=featureId + return currentGeometry; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { geomReduce } from "@turf/meta"; +const result = geomReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.geomReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/geometry.mdx b/versioned_docs/version-7.0.0/api/geometry.mdx new file mode 100644 index 00000000..cafae02a --- /dev/null +++ b/versioned_docs/version-7.0.0/api/geometry.mdx @@ -0,0 +1,52 @@ +--- +title: geometry +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a GeoJSON [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) from a Geometry string type & coordinates. +For GeometryCollection type use `helpers.geometryCollection` + +### Parameters + +| Name | Type | Description | +| --------------- | ---------------- | ------------------------------------ | +| type | **string** | Geometry Type | +| coordinates | **Array\** | Coordinates | +| options? | **Object** | Optional Parameters _(default \{\})_ | + +### Returns + +
    + **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** a GeoJSON Geometry + +
+ +### Examples + +```javascript +var type = "Point"; +var coordinates = [110, 50]; +var geometry = turf.geometry(type, coordinates); +// => geometry +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { geometry } from "@turf/helpers"; +const result = geometry(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.geometry(...); +``` diff --git a/versioned_docs/version-7.0.0/api/geometryCollection.mdx b/versioned_docs/version-7.0.0/api/geometryCollection.mdx new file mode 100644 index 00000000..9adfcf6b --- /dev/null +++ b/versioned_docs/version-7.0.0/api/geometryCollection.mdx @@ -0,0 +1,58 @@ +--- +title: geometryCollection +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8)\> based on a +coordinate array. Properties can be added optionally. + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------- | +| geometries | **Array\<[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)\>** | an array of GeoJSON Geometries | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8)\>** a GeoJSON GeometryCollection Feature + +
+ +### Examples + +```javascript +var pt = turf.geometry("Point", [100, 0]); +var line = turf.geometry("LineString", [ + [101, 0], + [102, 1], +]); +var collection = turf.geometryCollection([pt, line]); + +// => collection +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { geometryCollection } from "@turf/helpers"; +const result = geometryCollection(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.geometryCollection(...); +``` diff --git a/versioned_docs/version-7.0.0/api/getCluster.mdx b/versioned_docs/version-7.0.0/api/getCluster.mdx new file mode 100644 index 00000000..deef155c --- /dev/null +++ b/versioned_docs/version-7.0.0/api/getCluster.mdx @@ -0,0 +1,66 @@ +--- +title: getCluster +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Get Cluster + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------------------ | ------------------------------------------------ | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** | GeoJSON Features | +| filter | **\*** | Filter used on GeoJSON properties to get Cluster | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** Single Cluster filtered by GeoJSON Properties + +
+ +### Examples + +```javascript +var geojson = turf.featureCollection([ + turf.point([0, 0], { "marker-symbol": "circle" }), + turf.point([2, 4], { "marker-symbol": "star" }), + turf.point([3, 6], { "marker-symbol": "star" }), + turf.point([5, 1], { "marker-symbol": "square" }), + turf.point([4, 2], { "marker-symbol": "circle" }), +]); + +// Create a cluster using K-Means (adds `cluster` to GeoJSON properties) +var clustered = turf.clustersKmeans(geojson); + +// Retrieve first cluster (0) +var cluster = turf.getCluster(clustered, { cluster: 0 }); +//= cluster + +// Retrieve cluster based on custom properties +turf.getCluster(clustered, { "marker-symbol": "circle" }).length; +//= 2 +turf.getCluster(clustered, { "marker-symbol": "square" }).length; +//= 1 +``` + +### Installation + +```javascript +$ npm install @turf/clusters + +import { getCluster } from "@turf/clusters"; +const result = getCluster(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.getCluster(...); +``` diff --git a/versioned_docs/version-7.0.0/api/getCoord.mdx b/versioned_docs/version-7.0.0/api/getCoord.mdx new file mode 100644 index 00000000..07a41450 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/getCoord.mdx @@ -0,0 +1,49 @@ +--- +title: getCoord +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Unwrap a coordinate from a Point Feature, Geometry or a single coordinate. + +### Parameters + +| Name | Type | Description | +| ----- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| coord | **Array\ \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\> \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | GeoJSON Point or an Array of numbers | + +### Returns + +
    + **Array\** coordinates + +
+ +### Examples + +```javascript +var pt = turf.point([10, 10]); + +var coord = turf.getCoord(pt); +//= [10, 10] +``` + +### Installation + +```javascript +$ npm install @turf/invariant + +import { getCoord } from "@turf/invariant"; +const result = getCoord(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.getCoord(...); +``` diff --git a/versioned_docs/version-7.0.0/api/getCoords.mdx b/versioned_docs/version-7.0.0/api/getCoords.mdx new file mode 100644 index 00000000..6c6bf396 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/getCoords.mdx @@ -0,0 +1,56 @@ +--- +title: getCoords +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Unwrap coordinates from a Feature, Geometry Object or an Array + +### Parameters + +| Name | Type | Description | +| ------ | --------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| coords | **Array\ \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | Feature, Geometry Object or an Array | + +### Returns + +
    + **Array\** coordinates + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [119.32, -8.7], + [119.55, -8.69], + [119.51, -8.54], + [119.32, -8.7], + ], +]); + +var coords = turf.getCoords(poly); +//= [[[119.32, -8.7], [119.55, -8.69], [119.51, -8.54], [119.32, -8.7]]] +``` + +### Installation + +```javascript +$ npm install @turf/invariant + +import { getCoords } from "@turf/invariant"; +const result = getCoords(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.getCoords(...); +``` diff --git a/versioned_docs/version-7.0.0/api/getGeom.mdx b/versioned_docs/version-7.0.0/api/getGeom.mdx new file mode 100644 index 00000000..c17f8e1d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/getGeom.mdx @@ -0,0 +1,55 @@ +--- +title: getGeom +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Get Geometry from Feature or Geometry Object + +### Parameters + +| Name | Type | Description | +| ------- | ----------------------------------------------------------------------------------------------------------------------------- | ---------------------------------- | +| geojson | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | GeoJSON Feature or Geometry Object | + +### Returns + +
    + **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| null** GeoJSON Geometry Object + +
+ +### Examples + +```javascript +var point = { + type: "Feature", + properties: {}, + geometry: { + type: "Point", + coordinates: [110, 40], + }, +}; +var geom = turf.getGeom(point); +//={"type": "Point", "coordinates": [110, 40]} +``` + +### Installation + +```javascript +$ npm install @turf/invariant + +import { getGeom } from "@turf/invariant"; +const result = getGeom(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.getGeom(...); +``` diff --git a/versioned_docs/version-7.0.0/api/getType.mdx b/versioned_docs/version-7.0.0/api/getType.mdx new file mode 100644 index 00000000..1efae6ae --- /dev/null +++ b/versioned_docs/version-7.0.0/api/getType.mdx @@ -0,0 +1,56 @@ +--- +title: getType +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Get GeoJSON object's type, Geometry type is prioritize. + +### Parameters + +| Name | Type | Description | +| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON object | +| name? | **string** | name of the variable to display in error message (unused) _(default "geojson")_ | + +### Returns + +
    + **string** GeoJSON type + +
+ +### Examples + +```javascript +var point = { + type: "Feature", + properties: {}, + geometry: { + type: "Point", + coordinates: [110, 40], + }, +}; +var geom = turf.getType(point); +//="Point" +``` + +### Installation + +```javascript +$ npm install @turf/invariant + +import { getType } from "@turf/invariant"; +const result = getType(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.getType(...); +``` diff --git a/versioned_docs/version-7.0.0/api/greatCircle.mdx b/versioned_docs/version-7.0.0/api/greatCircle.mdx new file mode 100644 index 00000000..d5405bb8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/greatCircle.mdx @@ -0,0 +1,79 @@ +--- +title: greatCircle +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Calculate great circles routes as [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) or [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5). +If the `start` and `end` points span the antimeridian, the resulting feature will +be split into a `MultiLineString`. + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| start | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | source point feature | +| end | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | destination point feature | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | line feature properties _(default \{\})_ | +| options.npoints? | **number** | number of points _(default 100)_ | +| options.offset? | **number** | offset controls the likelyhood that lines will be split which cross the dateline. The higher the number the more likely. _(default 10)_ | + +### Returns + +
    + **[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)\>** great circle line feature + +
+ +### Examples + +```javascript +var start = turf.point([-122, 48]); +var end = turf.point([-77, 39]); + +var greatCircle = turf.greatCircle(start, end, { + properties: { name: "Seattle to DC" }, +}); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var start = turf.point([-122, 48]); + var end = turf.point([-77, 39]); + + var greatCircle = turf.greatCircle(start, end, { + properties: { name: "Seattle to DC" }, + }); + + //addToMap + var addToMap = { start, end, greatCircle }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/great-circle + +import { greatCircle } from "@turf/great-circle"; +const result = greatCircle(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.greatCircle(...); +``` diff --git a/versioned_docs/version-7.0.0/api/hexGrid.mdx b/versioned_docs/version-7.0.0/api/hexGrid.mdx new file mode 100644 index 00000000..7e678d9e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/hexGrid.mdx @@ -0,0 +1,78 @@ +--- +title: hexGrid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a bounding box and the diameter of the cell and returns a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of flat-topped +hexagons or triangles ([Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) features) aligned in an "odd-q" vertical grid as +described in [Hexagonal Grids](http://www.redblobgames.com/grids/hexagons/). + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------- | +| bbox | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | extent in [minX, minY, maxX, maxY] order | +| cellSide | **number** | 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** | Optional parameters _(default \{\})_ | +| options.units? | **string** | used in calculating cell size, can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.properties? | **Object** | passed to each hexagon or triangle of the grid _(default \{\})_ | +| options.mask? | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it | +| options.triangles? | **boolean** | whether to return as triangles instead of hexagons _(default false)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a hexagonal grid + +
+ +### Examples + +```javascript +var bbox = [-96, 31, -84, 40]; +var cellSide = 50; +var options = { units: "miles" }; + +var hexgrid = turf.hexGrid(bbox, cellSide, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [-96, 31, -84, 40]; + var cellSide = 50; + var options = { units: "miles" }; + + var hexgrid = turf.hexGrid(bbox, cellSide, options); + + //addToMap + var addToMap = { hexgrid }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/hex-grid + +import { hexGrid } from "@turf/hex-grid"; +const result = hexGrid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.hexGrid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/interpolate.mdx b/versioned_docs/version-7.0.0/api/interpolate.mdx new file mode 100644 index 00000000..04694454 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/interpolate.mdx @@ -0,0 +1,82 @@ +--- +title: interpolate +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of points and estimates their 'property' values on a grid using the [Inverse Distance Weighting (IDW) method](https://en.wikipedia.org/wiki/Inverse_distance_weighting). + +### Parameters + +| Name | Type | Description | +| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | with known value | +| cellSize | **number** | the distance across each grid point | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.gridType? | **string** | defines the output format based on a Grid Type (options: 'square' \| 'point' \| 'hex' \| 'triangle') _(default 'square')_ | +| options.property? | **string** | the property name in `points` from which z-values will be pulled, zValue fallbacks to 3rd coordinate if no property exists. _(default 'elevation')_ | +| options.units? | **string** | used in calculating cellSize, can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.weight? | **number** | exponent regulating the distance-decay weighting _(default 1)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** grid of points or polygons with interpolated 'property' + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/interpolate + +import { interpolate } from "@turf/interpolate"; +const result = interpolate(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.interpolate(...); +``` diff --git a/versioned_docs/version-7.0.0/api/intersect.mdx b/versioned_docs/version-7.0.0/api/intersect.mdx new file mode 100644 index 00000000..292c7ce1 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/intersect.mdx @@ -0,0 +1,112 @@ +--- +title: intersect +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes [polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) or [multi-polygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) geometries and +finds their polygonal intersection. If they don't intersect, returns null. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | +| features | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | the features to intersect | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.properties? | **Object** | Translate GeoJSON Properties to Feature _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| null** returns a feature representing the area they share (either a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) or +[MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)). If they do not share any area, returns `null`. + +
+ +### 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(turf.featureCollection([poly1, poly2])); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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(turf.featureCollection([poly1, poly2])); + + //addToMap + var addToMap = { poly1, poly2, intersection }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/intersect + +import { intersect } from "@turf/intersect"; +const result = intersect(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.intersect(...); +``` diff --git a/versioned_docs/version-7.0.0/api/isNumber.mdx b/versioned_docs/version-7.0.0/api/isNumber.mdx new file mode 100644 index 00000000..95bb4d13 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/isNumber.mdx @@ -0,0 +1,49 @@ +--- +title: isNumber +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +isNumber + +### Parameters + +| Name | Type | Description | +| ---- | ------ | ------------------ | +| num | **\*** | Number to validate | + +### Returns + +
    + **boolean** true/false + +
+ +### Examples + +```javascript +turf.isNumber(123); +//=true +turf.isNumber("foo"); +//=false +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { isNumber } from "@turf/helpers"; +const result = isNumber(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.isNumber(...); +``` diff --git a/versioned_docs/version-7.0.0/api/isObject.mdx b/versioned_docs/version-7.0.0/api/isObject.mdx new file mode 100644 index 00000000..5b98f8ed --- /dev/null +++ b/versioned_docs/version-7.0.0/api/isObject.mdx @@ -0,0 +1,49 @@ +--- +title: isObject +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +isObject + +### Parameters + +| Name | Type | Description | +| ----- | ------ | -------------------- | +| input | **\*** | variable to validate | + +### Returns + +
    + **boolean** true/false, including false for Arrays and Functions + +
+ +### Examples + +```javascript +turf.isObject({ elevation: 10 }); +//=true +turf.isObject("foo"); +//=false +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { isObject } from "@turf/helpers"; +const result = isObject(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.isObject(...); +``` diff --git a/versioned_docs/version-7.0.0/api/isobands.mdx b/versioned_docs/version-7.0.0/api/isobands.mdx new file mode 100644 index 00000000..2d66b510 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/isobands.mdx @@ -0,0 +1,46 @@ +--- +title: isobands +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a square or rectangular grid [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) features with z-values and an array of +value breaks and generates filled contour isobands. + +### Parameters + +| Name | Type | Description | +| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| pointGrid | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | input points - must be square or rectangular | +| breaks | **Array\** | where to draw contours | +| options? | **Object** | options on output _(default \{\})_ | +| options.zProperty? | **string** | the property name in `points` from which z-values will be pulled _(default 'elevation')_ | +| options.commonProperties? | **Object** | GeoJSON properties passed to ALL isobands _(default \{\})_ | +| options.breaksProperties? | **Array\** | GeoJSON properties passed, in order, to the correspondent isoband (order defined by breaks) _(default [])_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** a FeatureCollection of [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) features representing isobands + +
+ +### Installation + +```javascript +$ npm install @turf/isobands + +import { isobands } from "@turf/isobands"; +const result = isobands(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.isobands(...); +``` diff --git a/versioned_docs/version-7.0.0/api/isolines.mdx b/versioned_docs/version-7.0.0/api/isolines.mdx new file mode 100644 index 00000000..edfd771b --- /dev/null +++ b/versioned_docs/version-7.0.0/api/isolines.mdx @@ -0,0 +1,88 @@ +--- +title: isolines +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a grid [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) features with z-values and an array of +value breaks and generates [isolines](https://en.wikipedia.org/wiki/Contour_line). + +### Parameters + +| Name | Type | Description | +| -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- | +| pointGrid | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | input points | +| breaks | **Array\** | values of `zProperty` where to draw isolines | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.zProperty? | **string** | the property name in `points` from which z-values will be pulled _(default 'elevation')_ | +| options.commonProperties? | **Object** | GeoJSON properties passed to ALL isolines _(default \{\})_ | +| options.breaksProperties? | **Array\** | GeoJSON properties passed, in order, to the correspondent isoline; the breaks array will define the order in which the isolines are created _(default [])_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5)\>** a FeatureCollection of [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) features representing isolines + +
+ +### Examples + +```javascript +// create a grid of points with random z-values in their properties +var extent = [0, 30, 20, 50]; +var cellWidth = 100; +var pointGrid = turf.pointGrid(extent, cellWidth, { units: "miles" }); + +for (var i = 0; i < pointGrid.features.length; i++) { + pointGrid.features[i].properties.temperature = Math.random() * 10; +} +var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + +var lines = turf.isolines(pointGrid, breaks, { zProperty: "temperature" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + // create a grid of points with random z-values in their properties + var extent = [0, 30, 20, 50]; + var cellWidth = 100; + var pointGrid = turf.pointGrid(extent, cellWidth, { units: "miles" }); + + for (var i = 0; i < pointGrid.features.length; i++) { + pointGrid.features[i].properties.temperature = Math.random() * 10; + } + var breaks = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; + + var lines = turf.isolines(pointGrid, breaks, { zProperty: "temperature" }); + + //addToMap + var addToMap = { lines }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/isolines + +import { isolines } from "@turf/isolines"; +const result = isolines(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.isolines(...); +``` diff --git a/versioned_docs/version-7.0.0/api/kinks.mdx b/versioned_docs/version-7.0.0/api/kinks.mdx new file mode 100644 index 00000000..c9f4bfe7 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/kinks.mdx @@ -0,0 +1,84 @@ +--- +title: kinks +--- + +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), [multi-linestring](https://tools.ietf.org/html/rfc7946#section-3.1.5), +[multi-polygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) or [polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) and +returns [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) at all self-intersections. + +### Parameters + +| Name | Type | Description | +| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | +| featureIn | **[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) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | input feature | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** self-intersections + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [-12.034835, 8.901183], + [-12.060413, 8.899826], + [-12.03638, 8.873199], + [-12.059383, 8.871418], + [-12.034835, 8.901183], + ], +]); + +var kinks = turf.kinks(poly); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly = turf.polygon([ + [ + [-12.034835, 8.901183], + [-12.060413, 8.899826], + [-12.03638, 8.873199], + [-12.059383, 8.871418], + [-12.034835, 8.901183], + ], + ]); + + var kinks = turf.kinks(poly); + + //addToMap + var addToMap = { poly, kinks }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/kinks + +import { kinks } from "@turf/kinks"; +const result = kinks(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.kinks(...); +``` diff --git a/versioned_docs/version-7.0.0/api/length.mdx b/versioned_docs/version-7.0.0/api/length.mdx new file mode 100644 index 00000000..d99b4342 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/length.mdx @@ -0,0 +1,77 @@ +--- +title: length +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [GeoJSON](https://tools.ietf.org/html/rfc7946#section-3) and measures its length in the specified units, [(Multi)Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)'s distance are ignored. + +### Parameters + +| Name | Type | Description | +| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | +| geojson | **[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)\>** | GeoJSON to measure | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default kilometers)_ | + +### Returns + +
    + **number** length of GeoJSON + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [115, -32], + [131, -22], + [143, -25], + [150, -34], +]); +var length = turf.length(line, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [115, -32], + [131, -22], + [143, -25], + [150, -34], + ]); + var length = turf.length(line, { units: "miles" }); + + //addToMap + var addToMap = { line }; + line.properties.distance = length; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/length + +import { length } from "@turf/length"; +const result = length(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.length(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lengthToDegrees.mdx b/versioned_docs/version-7.0.0/api/lengthToDegrees.mdx new file mode 100644 index 00000000..d088c5c4 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lengthToDegrees.mdx @@ -0,0 +1,42 @@ +--- +title: lengthToDegrees +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Convert a distance measurement (assuming a spherical Earth) from a real-world unit into degrees +Valid units: miles, nauticalmiles, inches, yards, meters, metres, centimeters, kilometres, feet + +### Parameters + +| Name | Type | Description | +| ------------- | ---------- | --------------------------------------------------------------------------------------------------------------- | +| distance | **number** | in real units | +| units? | **string** | can be degrees, radians, miles, inches, yards, metres, meters, kilometres, kilometers. _(default "kilometers")_ | + +### Returns + +
    + **number** degrees + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { lengthToDegrees } from "@turf/helpers"; +const result = lengthToDegrees(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lengthToDegrees(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lengthToRadians.mdx b/versioned_docs/version-7.0.0/api/lengthToRadians.mdx new file mode 100644 index 00000000..f0292908 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lengthToRadians.mdx @@ -0,0 +1,42 @@ +--- +title: lengthToRadians +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Convert a distance measurement (assuming a spherical Earth) from a real-world unit into radians +Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet + +### Parameters + +| Name | Type | Description | +| ------------- | ---------- | --------------------------------------------------------------------------------------------------------------- | +| distance | **number** | in real units | +| units? | **string** | can be degrees, radians, miles, inches, yards, metres, meters, kilometres, kilometers. _(default "kilometers")_ | + +### Returns + +
    + **number** radians + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { lengthToRadians } from "@turf/helpers"; +const result = lengthToRadians(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lengthToRadians(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineArc.mdx b/versioned_docs/version-7.0.0/api/lineArc.mdx new file mode 100644 index 00000000..eb08ff69 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineArc.mdx @@ -0,0 +1,79 @@ +--- +title: lineArc +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a circular arc, of a circle of the given radius and center point, between bearing1 and bearing2; +0 bearing is North of center point, positive clockwise. + +### Parameters + +| Name | Type | Description | +| --------------------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| center | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | center point | +| radius | **number** | radius of the circle | +| bearing1 | **number** | angle, in decimal degrees, of the first radius of the arc | +| bearing2 | **number** | angle, in decimal degrees, of the second radius of the arc | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.steps? | **number** | number of steps (straight segments) that will constitute the arc _(default 64)_ | +| options.units? | **string** | miles, kilometers, degrees, or radians _(default 'kilometers')_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** line arc + +
+ +### Examples + +```javascript +var center = turf.point([-75, 40]); +var radius = 5; +var bearing1 = 25; +var bearing2 = 47; + +var arc = turf.lineArc(center, radius, bearing1, bearing2); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var center = turf.point([-75, 40]); + var radius = 5; + var bearing1 = 25; + var bearing2 = 47; + + var arc = turf.lineArc(center, radius, bearing1, bearing2); + + //addToMap + var addToMap = { center, arc }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-arc + +import { lineArc } from "@turf/line-arc"; +const result = lineArc(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineArc(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineChunk.mdx b/versioned_docs/version-7.0.0/api/lineChunk.mdx new file mode 100644 index 00000000..a6c22dfc --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineChunk.mdx @@ -0,0 +1,79 @@ +--- +title: lineChunk +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Divides a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) into chunks of a specified length. +If the line is shorter than the segment length then the original line is returned. + +### Parameters + +| Name | Type | Description | +| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------ | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | the lines to split | +| segmentLength | **number** | how long to make each segment | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | units can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.reverse? | **boolean** | reverses coordinates to start the first chunked segment at the end _(default false)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** collection of line segments + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [-95, 40], + [-93, 45], + [-85, 50], +]); + +var chunk = turf.lineChunk(line, 15, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [-95, 40], + [-93, 45], + [-85, 50], + ]); + + var chunk = turf.lineChunk(line, 15, { units: "miles" }); + + //addToMap + var addToMap = { chunk }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-chunk + +import { lineChunk } from "@turf/line-chunk"; +const result = lineChunk(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineChunk(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineEach.mdx b/versioned_docs/version-7.0.0/api/lineEach.mdx new file mode 100644 index 00000000..a8d178c9 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineEach.mdx @@ -0,0 +1,63 @@ +--- +title: lineEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over line or ring coordinates in LineString, Polygon, MultiLineString, MultiPolygon Features or Geometries, +similar to Array.forEach. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------- | +| geojson | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | object | +| callback | **Function** | a method that takes (currentLine, featureIndex, multiFeatureIndex, geometryIndex) | + +### Returns + +### Examples + +```javascript +var multiLine = turf.multiLineString([ + [ + [26, 37], + [35, 45], + ], + [ + [36, 53], + [38, 50], + [41, 55], + ], +]); + +turf.lineEach( + multiLine, + function (currentLine, featureIndex, multiFeatureIndex, geometryIndex) { + //=currentLine + //=featureIndex + //=multiFeatureIndex + //=geometryIndex + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { lineEach } from "@turf/meta"; +const result = lineEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineIntersect.mdx b/versioned_docs/version-7.0.0/api/lineIntersect.mdx new file mode 100644 index 00000000..571653d2 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineIntersect.mdx @@ -0,0 +1,82 @@ +--- +title: lineIntersect +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes any LineString or Polygon GeoJSON and returns the intersecting point(s). + +### Parameters + +| Name | Type | Description | +| --------------------------------------- | ------------------------------------------------------------ | -------------------------------------------------------------- | +| line1 | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any LineString or Polygon | +| line2 | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any LineString or Polygon | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.removeDuplicates? | **boolean** | remove duplicate intersections _(default true)_ | +| options.ignoreSelfIntersections? | **boolean** | ignores self-intersections on input features _(default false)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** point(s) that intersect both + +
+ +### Examples + +```javascript +var line1 = turf.lineString([ + [126, -11], + [129, -21], +]); +var line2 = turf.lineString([ + [123, -18], + [131, -14], +]); +var intersects = turf.lineIntersect(line1, line2); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line1 = turf.lineString([ + [126, -11], + [129, -21], + ]); + var line2 = turf.lineString([ + [123, -18], + [131, -14], + ]); + var intersects = turf.lineIntersect(line1, line2); + + //addToMap + var addToMap = { line1, line2, intersects }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-intersect + +import { lineIntersect } from "@turf/line-intersect"; +const result = lineIntersect(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineIntersect(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineOffset.mdx b/versioned_docs/version-7.0.0/api/lineOffset.mdx new file mode 100644 index 00000000..a58b65bc --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineOffset.mdx @@ -0,0 +1,84 @@ +--- +title: lineOffset +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4) and returns a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4) at offset by the specified distance. + +### Parameters + +| Name | Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------ | +| geojson | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | input GeoJSON | +| distance | **number** | distance to offset the line (can be of negative value) | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, kilometers, inches, yards, meters _(default 'kilometers')_ | + +### Returns + +
    + **[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)\>** Line offset from the input line + +
+ +### Examples + +```javascript +var line = turf.lineString( + [ + [-83, 30], + [-84, 36], + [-78, 41], + ], + { stroke: "#F00" }, +); + +var offsetLine = turf.lineOffset(line, 2, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString( + [ + [-83, 30], + [-84, 36], + [-78, 41], + ], + { stroke: "#F00" }, + ); + + var offsetLine = turf.lineOffset(line, 2, { units: "miles" }); + + //addToMap + var addToMap = { offsetLine, line }; + offsetLine.properties.stroke = "#00F"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-offset + +import { lineOffset } from "@turf/line-offset"; +const result = lineOffset(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineOffset(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineOverlap.mdx b/versioned_docs/version-7.0.0/api/lineOverlap.mdx new file mode 100644 index 00000000..cbf4151f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineOverlap.mdx @@ -0,0 +1,91 @@ +--- +title: lineOverlap +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes any LineString or Polygon and returns the overlapping lines between both features. + +### Parameters + +| Name | Type | Description | +| ------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------- | +| line1 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | any LineString or Polygon | +| line2 | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | any LineString or Polygon | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.tolerance? | **number** | Tolerance distance to match overlapping line segments (in kilometers) _(default 0)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** lines(s) that are overlapping between both features + +
+ +### Examples + +```javascript +var line1 = turf.lineString([ + [115, -35], + [125, -30], + [135, -30], + [145, -35], +]); +var line2 = turf.lineString([ + [115, -25], + [125, -30], + [135, -30], + [145, -25], +]); + +var overlapping = turf.lineOverlap(line1, line2); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line1 = turf.lineString([ + [115, -35], + [125, -30], + [135, -30], + [145, -35], + ]); + var line2 = turf.lineString([ + [115, -25], + [125, -30], + [135, -30], + [145, -25], + ]); + + var overlapping = turf.lineOverlap(line1, line2); + + //addToMap + var addToMap = { line1, line2, overlapping }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-overlap + +import { lineOverlap } from "@turf/line-overlap"; +const result = lineOverlap(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineOverlap(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineReduce.mdx b/versioned_docs/version-7.0.0/api/lineReduce.mdx new file mode 100644 index 00000000..a10d4848 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineReduce.mdx @@ -0,0 +1,90 @@ +--- +title: lineReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce features in any GeoJSON object, similar to Array.reduce(). + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ | +| geojson | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | object | +| callback | **Function** | a method that takes (previousValue, currentLine, featureIndex, multiFeatureIndex, geometryIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var multiPoly = turf.multiPolygon([ + turf.polygon([ + [ + [12, 48], + [2, 41], + [24, 38], + [12, 48], + ], + [ + [9, 44], + [13, 41], + [13, 45], + [9, 44], + ], + ]), + turf.polygon([ + [ + [5, 5], + [0, 0], + [2, 2], + [4, 4], + [5, 5], + ], + ]), +]); + +turf.lineReduce( + multiPoly, + function ( + previousValue, + currentLine, + featureIndex, + multiFeatureIndex, + geometryIndex, + ) { + //=previousValue + //=currentLine + //=featureIndex + //=multiFeatureIndex + //=geometryIndex + return currentLine; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { lineReduce } from "@turf/meta"; +const result = lineReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineSegment.mdx b/versioned_docs/version-7.0.0/api/lineSegment.mdx new file mode 100644 index 00000000..b8b71a04 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineSegment.mdx @@ -0,0 +1,81 @@ +--- +title: lineSegment +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of 2-vertex [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) segments from a +[(Multi)LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) or [(Multi)Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6). + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | ----------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON Polygon or LineString | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** 2-vertex line segments + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [-50, 5], + [-40, -10], + [-50, -10], + [-40, 5], + [-50, 5], + ], +]); +var segments = turf.lineSegment(polygon); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [-50, 5], + [-40, -10], + [-50, -10], + [-40, 5], + [-50, 5], + ], + ]); + var segments = turf.lineSegment(polygon); + + //addToMap + var addToMap = { polygon, segments }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-segment + +import { lineSegment } from "@turf/line-segment"; +const result = lineSegment(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineSegment(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineSlice.mdx b/versioned_docs/version-7.0.0/api/lineSlice.mdx new file mode 100644 index 00000000..6fa1ffa6 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineSlice.mdx @@ -0,0 +1,90 @@ +--- +title: lineSlice +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4), a start [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2), and a stop point +and returns a subsection of the line in-between those points. +The start & stop points don't need to fall exactly on the line. + +This can be useful for extracting only the part of a route between waypoints. + +### Parameters + +| Name | Type | Description | +| ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | +| startPt | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | starting point | +| stopPt | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | stopping point | +| line | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\> \| [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)** | line to slice | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** sliced line + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368], +]); +var start = turf.point([-77.029609, 38.881946]); +var stop = turf.point([-77.021884, 38.889563]); + +var sliced = turf.lineSlice(start, stop, line); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368], + ]); + var start = turf.point([-77.029609, 38.881946]); + var stop = turf.point([-77.021884, 38.889563]); + + var sliced = turf.lineSlice(start, stop, line); + + //addToMap + var addToMap = { start, stop, line }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-slice + +import { lineSlice } from "@turf/line-slice"; +const result = lineSlice(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineSlice(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineSliceAlong.mdx b/versioned_docs/version-7.0.0/api/lineSliceAlong.mdx new file mode 100644 index 00000000..309f54a9 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineSliceAlong.mdx @@ -0,0 +1,86 @@ +--- +title: lineSliceAlong +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4), a specified distance along the line to a start [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2), +and a specified distance along the line to a stop point +and returns a subsection of the line in-between those points. + +This can be useful for extracting only the part of a route between two distances. + +### 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)\> \| [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)** | input line | +| startDist | **number** | distance along the line to starting point | +| stopDist | **number** | distance along the line to ending point | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** sliced line + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [7, 45], + [9, 45], + [14, 40], + [14, 41], +]); +var start = 12.5; +var stop = 25; +var sliced = turf.lineSliceAlong(line, start, stop, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [7, 45], + [9, 45], + [14, 40], + [14, 41], + ]); + var start = 12.5; + var stop = 25; + var sliced = turf.lineSliceAlong(line, start, stop, { units: "miles" }); + + //addToMap + var addToMap = { line, start, stop, sliced }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-slice-along + +import { lineSliceAlong } from "@turf/line-slice-along"; +const result = lineSliceAlong(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineSliceAlong(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineSplit.mdx b/versioned_docs/version-7.0.0/api/lineSplit.mdx new file mode 100644 index 00000000..8167dbeb --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineSplit.mdx @@ -0,0 +1,81 @@ +--- +title: lineSplit +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Split a LineString by another GeoJSON Feature. + +### 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)\>** | LineString Feature to split | +| splitter | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\** | Feature used to split line | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** Split LineStrings + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [120, -25], + [145, -25], +]); +var splitter = turf.lineString([ + [130, -15], + [130, -35], +]); + +var split = turf.lineSplit(line, splitter); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [120, -25], + [145, -25], + ]); + var splitter = turf.lineString([ + [130, -15], + [130, -35], + ]); + + var split = turf.lineSplit(line, splitter); + + //addToMap + var addToMap = { line, splitter }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-split + +import { lineSplit } from "@turf/line-split"; +const result = lineSplit(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineSplit(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineString.mdx b/versioned_docs/version-7.0.0/api/lineString.mdx new file mode 100644 index 00000000..8c0dc22c --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineString.mdx @@ -0,0 +1,70 @@ +--- +title: lineString +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from an Array of Positions. + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>** | an array of Positions | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** LineString Feature + +
+ +### Examples + +```javascript +var linestring1 = turf.lineString( + [ + [-24, 63], + [-23, 60], + [-25, 65], + [-20, 69], + ], + { name: "line 1" }, +); +var linestring2 = turf.lineString( + [ + [-14, 43], + [-13, 40], + [-15, 45], + [-10, 49], + ], + { name: "line 2" }, +); + +//=linestring1 +//=linestring2 +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { lineString } from "@turf/helpers"; +const result = lineString(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineString(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineStrings.mdx b/versioned_docs/version-7.0.0/api/lineStrings.mdx new file mode 100644 index 00000000..62406b85 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineStrings.mdx @@ -0,0 +1,65 @@ +--- +title: lineStrings +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of LineString coordinates. + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------- | ----------------------------------------------------------------------------------- | +| coordinates | **Array\\>\>** | an array of LinearRings | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the FeatureCollection | +| options.id? | **string \| number** | Identifier associated with the FeatureCollection | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** LineString FeatureCollection + +
+ +### Examples + +```javascript +var linestrings = turf.lineStrings([ + [ + [-24, 63], + [-23, 60], + [-25, 65], + [-20, 69], + ], + [ + [-14, 43], + [-13, 40], + [-15, 45], + [-10, 49], + ], +]); + +//=linestrings +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { lineStrings } from "@turf/helpers"; +const result = lineStrings(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineStrings(...); +``` diff --git a/versioned_docs/version-7.0.0/api/lineToPolygon.mdx b/versioned_docs/version-7.0.0/api/lineToPolygon.mdx new file mode 100644 index 00000000..1c28fc94 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/lineToPolygon.mdx @@ -0,0 +1,83 @@ +--- +title: lineToPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts (Multi)LineString(s) to Polygon(s). + +### Parameters + +| Name | Type | Description | +| ---------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | +| lines | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [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)\>** | Features to convert | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | translates GeoJSON properties to Feature _(default \{\})_ | +| options.autoComplete? | **boolean** | auto complete linestrings (matches first & last coordinates) _(default true)_ | +| options.orderCoords? | **boolean** | sorts linestrings to place outer ring at the first position of the coordinates _(default true)_ | +| options.mutate? | **boolean** | mutate the original linestring using autoComplete (matches first & last coordinates) _(default false)_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** converted to Polygons + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [125, -30], + [145, -30], + [145, -20], + [125, -20], + [125, -30], +]); + +var polygon = turf.lineToPolygon(line); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [125, -30], + [145, -30], + [145, -20], + [125, -20], + [125, -30], + ]); + + var polygon = turf.lineToPolygon(line); + + //addToMap + var addToMap = { polygon }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/line-to-polygon + +import { lineToPolygon } from "@turf/line-to-polygon"; +const result = lineToPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.lineToPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/mask.mdx b/versioned_docs/version-7.0.0/api/mask.mdx new file mode 100644 index 00000000..57823849 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/mask.mdx @@ -0,0 +1,103 @@ +--- +title: mask +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes any type of [polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) and an optional mask and returns a [polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) exterior ring with holes. + +### Parameters + +| Name | Type | Description | +| ------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------- | +| polygon | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | GeoJSON Polygon used as interior rings or holes. | +| mask? | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | GeoJSON Polygon used as the exterior ring (if undefined, the world extent is used) | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** Masked Polygon (exterior ring with holes). + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [112, -21], + [116, -36], + [146, -39], + [153, -24], + [133, -10], + [112, -21], + ], +]); +var mask = turf.polygon([ + [ + [90, -55], + [170, -55], + [170, 10], + [90, 10], + [90, -55], + ], +]); + +var masked = turf.mask(polygon, mask); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [112, -21], + [116, -36], + [146, -39], + [153, -24], + [133, -10], + [112, -21], + ], + ]); + var mask = turf.polygon([ + [ + [90, -55], + [170, -55], + [170, 10], + [90, 10], + [90, -55], + ], + ]); + + var masked = turf.mask(polygon, mask); + + //addToMap + var addToMap = { masked }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/mask + +import { mask } from "@turf/mask"; +const result = mask(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.mask(...); +``` diff --git a/versioned_docs/version-7.0.0/api/mean.mdx b/versioned_docs/version-7.0.0/api/mean.mdx new file mode 100644 index 00000000..a543462e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/mean.mdx @@ -0,0 +1,37 @@ +--- +title: mean +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +get mean of a list + +### Parameters + +| Name | Type | Description | +| ---- | ------------------- | ----------- | +| y | **Array\** | | + +### Returns + +
    **number**
+ +### Installation + +```javascript +$ npm install @turf/moran-index + +import { mean } from "@turf/moran-index"; +const result = mean(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.mean(...); +``` diff --git a/versioned_docs/version-7.0.0/api/midpoint.mdx b/versioned_docs/version-7.0.0/api/midpoint.mdx new file mode 100644 index 00000000..6c6f4e64 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/midpoint.mdx @@ -0,0 +1,71 @@ +--- +title: midpoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and returns a point midway between them. +The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account. + +### Parameters + +| Name | Type | Description | +| ------ | -------------------------------------------------------------- | ------------ | +| point1 | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | first point | +| point2 | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | second point | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** a point midway between `pt1` and `pt2` + +
+ +### Examples + +```javascript +var point1 = turf.point([144.834823, -37.771257]); +var point2 = turf.point([145.14244, -37.830937]); + +var midpoint = turf.midpoint(point1, point2); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var point1 = turf.point([144.834823, -37.771257]); + var point2 = turf.point([145.14244, -37.830937]); + + var midpoint = turf.midpoint(point1, point2); + + //addToMap + var addToMap = { point1, point2, midpoint }; + midpoint.properties["marker-color"] = "#f00"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/midpoint + +import { midpoint } from "@turf/midpoint"; +const result = midpoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.midpoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/moranIndex.mdx b/versioned_docs/version-7.0.0/api/moranIndex.mdx new file mode 100644 index 00000000..aa3d1690 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/moranIndex.mdx @@ -0,0 +1,73 @@ +--- +title: moranIndex +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Moran's I measures patterns of attribute values associated with features. +The method reveal whether similar values tend to occur near each other, +or whether high or low values are interspersed. + +Moran's I \> 0 means a clusterd pattern. +Moran's I \< 0 means a dispersed pattern. +Moran's I = 0 means a random pattern. + +In order to test the significance of the result. The z score is calculated. +A positive enough z-score (ex. \>1.96) indicates clustering, +while a negative enough z-score (ex. \<-1.96) indicates a dispersed pattern. + +the z-score can be calculated based on a normal or random assumption. + +**Bibliography\*** + +1. [Moran's I](https://en.wikipedia.org/wiki/Moran%27s_I) +1. [pysal](http://pysal.readthedocs.io/en/latest/index.html) +1. Andy Mitchell, The ESRI Guide to GIS Analysis Volume 2: Spatial Measurements & Statistics. + +### Parameters + +| Name | Type | Description | +| ------------------------------- | ------------------------------------------------------------------------------- | ---------------------------------------------------------- | +| fc | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\** | | +| options | **Object** | | +| options.inputField | **string** | the property name, must contain numeric values | +| options.threshold? | **number** | the distance threshold _(default 100000)_ | +| options.p? | **number** | the Minkowski p-norm distance parameter _(default 2)_ | +| options.binary? | **boolean** | whether transfrom the distance to binary _(default false)_ | +| options.alpha? | **number** | the distance decay parameter _(default -1)_ | +| options.standardization? | **boolean** | wheter row standardization the distance _(default true)_ | + +### Returns + +
    **MoranIndex**
+ +### Examples + +```javascript +const bbox = [-65, 40, -63, 42]; +const dataset = turf.randomPoint(100, { bbox: bbox }); + +const result = turf.moranIndex(dataset, { + inputField: "CRIME", +}); +``` + +### Installation + +```javascript +$ npm install @turf/moran-index + +import { moranIndex } from "@turf/moran-index"; +const result = moranIndex(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.moranIndex(...); +``` diff --git a/versioned_docs/version-7.0.0/api/multiLineString.mdx b/versioned_docs/version-7.0.0/api/multiLineString.mdx new file mode 100644 index 00000000..a59b3c00 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/multiLineString.mdx @@ -0,0 +1,58 @@ +--- +title: multiLineString +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5)\> based on a +coordinate array. Properties can be added optionally. + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>\>** | an array of LineStrings | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiLineString](https://tools.ietf.org/html/rfc7946#section-3.1.5)\>** a MultiLineString feature + +
+ +### Examples + +```javascript +var multiLine = turf.multiLineString([ + [ + [0, 0], + [10, 10], + ], +]); + +//=multiLine +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { multiLineString } from "@turf/helpers"; +const result = multiLineString(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.multiLineString(...); +``` diff --git a/versioned_docs/version-7.0.0/api/multiPoint.mdx b/versioned_docs/version-7.0.0/api/multiPoint.mdx new file mode 100644 index 00000000..34010a4c --- /dev/null +++ b/versioned_docs/version-7.0.0/api/multiPoint.mdx @@ -0,0 +1,56 @@ +--- +title: multiPoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3)\> based on a +coordinate array. Properties can be added optionally. + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>** | an array of Positions | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3)\>** a MultiPoint feature + +
+ +### Examples + +```javascript +var multiPt = turf.multiPoint([ + [0, 0], + [10, 10], +]); + +//=multiPt +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { multiPoint } from "@turf/helpers"; +const result = multiPoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.multiPoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/multiPolygon.mdx b/versioned_docs/version-7.0.0/api/multiPolygon.mdx new file mode 100644 index 00000000..4f2bd283 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/multiPolygon.mdx @@ -0,0 +1,63 @@ +--- +title: multiPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> based on a +coordinate array. Properties can be added optionally. + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>\>\>** | an array of Polygons | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** a multipolygon feature + +
+ +### Examples + +```javascript +var multiPoly = turf.multiPolygon([ + [ + [ + [0, 0], + [0, 10], + [10, 10], + [10, 0], + [0, 0], + ], + ], +]); + +//=multiPoly +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { multiPolygon } from "@turf/helpers"; +const result = multiPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.multiPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/nearestPoint.mdx b/versioned_docs/version-7.0.0/api/nearestPoint.mdx new file mode 100644 index 00000000..33d52fe4 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/nearestPoint.mdx @@ -0,0 +1,87 @@ +--- +title: nearestPoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a reference [point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a FeatureCollection of Features +with Point geometries and returns the +point from the FeatureCollection closest to the reference. This calculation +is geodesic. + +### Parameters + +| Name | Type | Description | +| --------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | +| targetPoint | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | the reference point | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | against input point set | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | the units of the numeric result _(default 'kilometers')_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** the closest point in the set to the reference point + +
+ +### Examples + +```javascript +var targetPoint = turf.point([28.965797, 41.010086], { + "marker-color": "#0F0", +}); +var points = turf.featureCollection([ + turf.point([28.973865, 41.011122]), + turf.point([28.948459, 41.024204]), + turf.point([28.938674, 41.013324]), +]); + +var nearest = turf.nearestPoint(targetPoint, points); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var targetPoint = turf.point([28.965797, 41.010086], { + "marker-color": "#0F0", + }); + var points = turf.featureCollection([ + turf.point([28.973865, 41.011122]), + turf.point([28.948459, 41.024204]), + turf.point([28.938674, 41.013324]), + ]); + + var nearest = turf.nearestPoint(targetPoint, points); + + //addToMap + var addToMap = { targetPoint, points, nearest }; + nearest.properties["marker-color"] = "#F00"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/nearest-point + +import { nearestPoint } from "@turf/nearest-point"; +const result = nearestPoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.nearestPoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/nearestPointOnLine.mdx b/versioned_docs/version-7.0.0/api/nearestPointOnLine.mdx new file mode 100644 index 00000000..f1236709 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/nearestPointOnLine.mdx @@ -0,0 +1,86 @@ +--- +title: nearestPointOnLine +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) and calculates the closest Point on the (Multi)LineString. + +### Parameters + +| Name | Type | Description | +| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- | +| lines | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | lines to snap to | +| pt | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\> \| Array\** | point to snap from | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** closest point on the `line` to `point`. The properties object will contain three values: `index`: closest point was found on nth line part, `dist`: distance between pt and the closest point, `location`: distance along the line between start and the closest point. + +
+ +### Examples + +```javascript +var line = turf.lineString([ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368], +]); +var pt = turf.point([-77.037076, 38.884017]); + +var snapped = turf.nearestPointOnLine(line, pt, { units: "miles" }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var line = turf.lineString([ + [-77.031669, 38.878605], + [-77.029609, 38.881946], + [-77.020339, 38.884084], + [-77.025661, 38.885821], + [-77.021884, 38.889563], + [-77.019824, 38.892368], + ]); + var pt = turf.point([-77.037076, 38.884017]); + + var snapped = turf.nearestPointOnLine(line, pt, { units: "miles" }); + + //addToMap + var addToMap = { line, pt, snapped }; + snapped.properties["marker-color"] = "#00f"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/nearest-point-on-line + +import { nearestPointOnLine } from "@turf/nearest-point-on-line"; +const result = nearestPointOnLine(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.nearestPointOnLine(...); +``` diff --git a/versioned_docs/version-7.0.0/api/nearestPointToLine.mdx b/versioned_docs/version-7.0.0/api/nearestPointToLine.mdx new file mode 100644 index 00000000..5ab15271 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/nearestPointToLine.mdx @@ -0,0 +1,83 @@ +--- +title: nearestPointToLine +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns the closest [point](https://tools.ietf.org/html/rfc7946#section-3.1.2), of a [collection](https://tools.ietf.org/html/rfc7946#section-3.3) of points, +to a [line](https://tools.ietf.org/html/rfc7946#section-3.1.4). The returned point has a `dist` property indicating its distance to the line. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [GeometryCollection](https://tools.ietf.org/html/rfc7946#section-3.1.8)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | Point Collection | +| line | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | Line Feature | +| options? | **Object** | Optional parameters | +| options.units? | **string** | unit of the output distance property (eg: degrees, radians, miles, or kilometers) _(default 'kilometers')_ | +| options.properties? | **Object** | Translate Properties to Point _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** the closest point + +
+ +### Examples + +```javascript +var pt1 = turf.point([0, 0]); +var pt2 = turf.point([0.5, 0.5]); +var points = turf.featureCollection([pt1, pt2]); +var line = turf.lineString([ + [1, 1], + [-1, 1], +]); + +var nearest = turf.nearestPointToLine(points, line); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var pt1 = turf.point([0, 0]); + var pt2 = turf.point([0.5, 0.5]); + var points = turf.featureCollection([pt1, pt2]); + var line = turf.lineString([ + [1, 1], + [-1, 1], + ]); + + var nearest = turf.nearestPointToLine(points, line); + + //addToMap + var addToMap = { nearest, line }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/nearest-point-to-line + +import { nearestPointToLine } from "@turf/nearest-point-to-line"; +const result = nearestPointToLine(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.nearestPointToLine(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pNormDistance.mdx b/versioned_docs/version-7.0.0/api/pNormDistance.mdx new file mode 100644 index 00000000..f5097df5 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pNormDistance.mdx @@ -0,0 +1,39 @@ +--- +title: pNormDistance +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +calcualte the Minkowski p-norm distance between two features. + +### Parameters + +| Name | Type | Description | +| -------- | ------------- | ------------------------------------------------------------------- | +| feature1 | **UNCERTAIN** | point feature | +| feature2 | **UNCERTAIN** | point feature | +| p | **UNCERTAIN** | p-norm 1=\**number** + +### Installation + +```javascript +$ npm install @turf/distance-weight + +import { pNormDistance } from "@turf/distance-weight"; +const result = pNormDistance(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pNormDistance(...); +``` diff --git a/versioned_docs/version-7.0.0/api/planepoint.mdx b/versioned_docs/version-7.0.0/api/planepoint.mdx new file mode 100644 index 00000000..f12673be --- /dev/null +++ b/versioned_docs/version-7.0.0/api/planepoint.mdx @@ -0,0 +1,106 @@ +--- +title: planepoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a triangular plane as a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) +and a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) within that triangle and returns the z-value +at that point. The Polygon should have properties `a`, `b`, and `c` +that define the values at its three corners. Alternatively, the z-values +of each triangle point can be provided by their respective 3rd coordinate +if their values are not provided as properties. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------ | +| point | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | the Point for which a z-value will be calculated | +| triangle | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | a Polygon feature with three vertices | + +### Returns + +
    + **number** the z-value for `interpolatedPoint` + +
+ +### Examples + +```javascript +var point = turf.point([-75.3221, 39.529]); +// "a", "b", and "c" values represent the values of the coordinates in order. +var triangle = turf.polygon( + [ + [ + [-75.1221, 39.57], + [-75.58, 39.18], + [-75.97, 39.86], + [-75.1221, 39.57], + ], + ], + { + a: 11, + b: 122, + c: 44, + }, +); + +var zValue = turf.planepoint(point, triangle); +point.properties.zValue = zValue; +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var point = turf.point([-75.3221, 39.529]); + // "a", "b", and "c" values represent the values of the coordinates in order. + var triangle = turf.polygon( + [ + [ + [-75.1221, 39.57], + [-75.58, 39.18], + [-75.97, 39.86], + [-75.1221, 39.57], + ], + ], + { + a: 11, + b: 122, + c: 44, + }, + ); + + var zValue = turf.planepoint(point, triangle); + point.properties.zValue = zValue; + + //addToMap + var addToMap = { triangle, point }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/planepoint + +import { planepoint } from "@turf/planepoint"; +const result = planepoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.planepoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/point.mdx b/versioned_docs/version-7.0.0/api/point.mdx new file mode 100644 index 00000000..d9b8ceeb --- /dev/null +++ b/versioned_docs/version-7.0.0/api/point.mdx @@ -0,0 +1,52 @@ +--- +title: point +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from a Position. + +### Parameters + +| Name | Type | Description | +| -------------------- | -------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\** | longitude, latitude position (each in decimal degrees) | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** a Point feature + +
+ +### Examples + +```javascript +var point = turf.point([-75.343, 39.984]); + +//=point +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { point } from "@turf/helpers"; +const result = point(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.point(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pointGrid.mdx b/versioned_docs/version-7.0.0/api/pointGrid.mdx new file mode 100644 index 00000000..505a2d9e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pointGrid.mdx @@ -0,0 +1,75 @@ +--- +title: pointGrid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) grid from a bounding box, [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) or [Feature](https://tools.ietf.org/html/rfc7946#section-3.2). + +### Parameters + +| Name | Type | Description | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| bbox | **Array\** | extent in [minX, minY, maxX, maxY] order | +| cellSide | **number** | the distance between points, in units | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | used in calculating cellSide, can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.mask? | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it | +| options.properties? | **Object** | passed to each point of the grid _(default \{\})_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** grid of points + +
+ +### Examples + +```javascript +var extent = [-70.823364, -33.553984, -70.473175, -33.302986]; +var cellSide = 3; +var options = { units: "miles" }; + +var grid = turf.pointGrid(extent, cellSide, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var extent = [-70.823364, -33.553984, -70.473175, -33.302986]; + var cellSide = 3; + var options = { units: "miles" }; + + var grid = turf.pointGrid(extent, cellSide, options); + + //addToMap + var addToMap = { grid }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/point-grid + +import { pointGrid } from "@turf/point-grid"; +const result = pointGrid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pointGrid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pointOnFeature.mdx b/versioned_docs/version-7.0.0/api/pointOnFeature.mdx new file mode 100644 index 00000000..4df04799 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pointOnFeature.mdx @@ -0,0 +1,90 @@ +--- +title: pointOnFeature +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a Feature or FeatureCollection and returns a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) guaranteed to be on the surface of the feature. + +- Given a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6), the point will be in the area of the polygon +- Given a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4), the point will be along the string +- Given a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2), the point will the same as the input + +### Parameters + +| Name | Type | Description | +| ------- | ------------------------------------------------------------ | -------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any Feature or FeatureCollection | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** a point on the surface of `input` + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [116, -36], + [131, -32], + [146, -43], + [155, -25], + [133, -9], + [111, -22], + [116, -36], + ], +]); + +var pointOnPolygon = turf.pointOnFeature(polygon); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [116, -36], + [131, -32], + [146, -43], + [155, -25], + [133, -9], + [111, -22], + [116, -36], + ], + ]); + + var pointOnPolygon = turf.pointOnFeature(polygon); + + //addToMap + var addToMap = { polygon, pointOnPolygon }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/point-on-feature + +import { pointOnFeature } from "@turf/point-on-feature"; +const result = pointOnFeature(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pointOnFeature(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pointToLineDistance.mdx b/versioned_docs/version-7.0.0/api/pointToLineDistance.mdx new file mode 100644 index 00000000..311c6379 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pointToLineDistance.mdx @@ -0,0 +1,58 @@ +--- +title: pointToLineDistance +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns the minimum distance between a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a [LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4), being the distance from a line the +minimum distance between the point and any segment of the `LineString`. + +### Parameters + +| Name | Type | Description | +| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------- | +| pt | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\> \| Array\** | Feature or Geometry | +| line | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** | GeoJSON Feature or Geometry | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be anything supported by turf/convertLength (ex: degrees, radians, miles, or kilometers) _(default "kilometers")_ | +| options.method? | **string** | wether to calculate the distance based on geodesic (spheroid) or planar (flat) method. Valid options are 'geodesic' or 'planar'. _(default "geodesic")_ | + +### Returns + +
    + **number** distance between point and line + +
+ +### 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 +``` + +### Installation + +```javascript +$ npm install @turf/point-to-line-distance + +import { pointToLineDistance } from "@turf/point-to-line-distance"; +const result = pointToLineDistance(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pointToLineDistance(...); +``` diff --git a/versioned_docs/version-7.0.0/api/points.mdx b/versioned_docs/version-7.0.0/api/points.mdx new file mode 100644 index 00000000..63aa23b8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/points.mdx @@ -0,0 +1,56 @@ +--- +title: points +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of Point coordinates. + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------------------------- | ----------------------------------------------------------------------------------- | +| coordinates | **Array\\>** | an array of Points | +| properties? | **Object** | Translate these properties to each Feature _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the FeatureCollection | +| options.id? | **string \| number** | Identifier associated with the FeatureCollection | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** Point Feature + +
+ +### Examples + +```javascript +var points = turf.points([ + [-75, 39], + [-80, 45], + [-78, 50], +]); + +//=points +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { points } from "@turf/helpers"; +const result = points(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.points(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pointsWithinPolygon.mdx b/versioned_docs/version-7.0.0/api/pointsWithinPolygon.mdx new file mode 100644 index 00000000..c22f9358 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pointsWithinPolygon.mdx @@ -0,0 +1,107 @@ +--- +title: pointsWithinPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Finds [Points](https://tools.ietf.org/html/rfc7946#section-3.1.2) or [MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3) coordinate positions that fall within [(Multi)Polygon(s)](https://tools.ietf.org/html/rfc7946#section-3.1.6). + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- | +| points | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) \| [MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3)\>** | Point(s) or MultiPoint(s) as input search | +| polygons | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | (Multi)Polygon(s) to check if points are within | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) \| [MultiPoint](https://tools.ietf.org/html/rfc7946#section-3.1.3)\>** Point(s) or MultiPoint(s) with positions that land within at least one polygon. The geometry type will match what was passsed in + +
+ +### 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.56], + [-46.653, -23.543], + ], +]); + +var ptsWithin = turf.pointsWithinPolygon(points, searchWithin); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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.56], + [-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"; + }); + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/points-within-polygon + +import { pointsWithinPolygon } from "@turf/points-within-polygon"; +const result = pointsWithinPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pointsWithinPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygon.mdx b/versioned_docs/version-7.0.0/api/polygon.mdx new file mode 100644 index 00000000..6ba3c362 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygon.mdx @@ -0,0 +1,63 @@ +--- +title: polygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) from an Array of LinearRings. + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>\>** | an array of LinearRings | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the Feature | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** Polygon Feature + +
+ +### Examples + +```javascript +var polygon = turf.polygon( + [ + [ + [-5, 52], + [-4, 56], + [-2, 51], + [-7, 54], + [-5, 52], + ], + ], + { name: "poly1" }, +); + +//=polygon +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { polygon } from "@turf/helpers"; +const result = polygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygonSmooth.mdx b/versioned_docs/version-7.0.0/api/polygonSmooth.mdx new file mode 100644 index 00000000..4133075d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygonSmooth.mdx @@ -0,0 +1,89 @@ +--- +title: polygonSmooth +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Smooths a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) or [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7). Based on [Chaikin's algorithm](http://graphics.cs.ucdavis.edu/education/CAGDNotes/Chaikins-Algorithm/Chaikins-Algorithm.html). +Warning: may create degenerate polygons. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------- | +| inputPolys | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\> \| [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)** | (Multi)Polygon(s) to smooth | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.iterations? | **string** | The number of times to smooth the polygon. A higher value means a smoother polygon. _(default 1)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** FeatureCollection containing the smoothed polygon/multipoylgons + +
+ +### 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 }); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/polygon-smooth + +import { polygonSmooth } from "@turf/polygon-smooth"; +const result = polygonSmooth(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygonSmooth(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygonTangents.mdx b/versioned_docs/version-7.0.0/api/polygonTangents.mdx new file mode 100644 index 00000000..72f78c88 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygonTangents.mdx @@ -0,0 +1,89 @@ +--- +title: polygonTangents +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Finds the tangents of a [(Multi)Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) from a [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2). + +### Parameters + +| Name | Type | Description | +| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------ | +| pt | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | to calculate the tangent points from | +| polygon | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | to get tangents from | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** Feature Collection containing the two tangent points + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/polygon-tangents + +import { polygonTangents } from "@turf/polygon-tangents"; +const result = polygonTangents(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygonTangents(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygonToLine.mdx b/versioned_docs/version-7.0.0/api/polygonToLine.mdx new file mode 100644 index 00000000..e20319a7 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygonToLine.mdx @@ -0,0 +1,85 @@ +--- +title: polygonToLine +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) to [(Multi)LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) or [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) to a +[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) of [(Multi)LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4). + +### Parameters + +| Name | Type | Description | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- | +| poly | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | Feature to convert | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.properties? | **Object** | translates GeoJSON properties to Feature _(default \{\})_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) \| MultiLinestring\>** converted (Multi)Polygon to (Multi)LineString + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [125, -30], + [145, -30], + [145, -20], + [125, -20], + [125, -30], + ], +]); + +var line = turf.polygonToLine(poly); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly = turf.polygon([ + [ + [125, -30], + [145, -30], + [145, -20], + [125, -20], + [125, -30], + ], + ]); + + var line = turf.polygonToLine(poly); + + //addToMap + var addToMap = { line }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/polygon-to-line + +import { polygonToLine } from "@turf/polygon-to-line"; +const result = polygonToLine(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygonToLine(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygonize.mdx b/versioned_docs/version-7.0.0/api/polygonize.mdx new file mode 100644 index 00000000..a092a155 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygonize.mdx @@ -0,0 +1,50 @@ +--- +title: polygonize +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Polygonizes [(Multi)LineString(s)](https://tools.ietf.org/html/rfc7946#section-3.1.4) into [Polygons](https://tools.ietf.org/html/rfc7946#section-3.1.6). + +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 + +| Name | Type | Description | +| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------- | +| geoJson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [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)\>** | Lines in order to polygonize | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** Polygons created + +
+ +### Installation + +```javascript +$ npm install @turf/polygonize + +import { polygonize } from "@turf/polygonize"; +const result = polygonize(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygonize(...); +``` diff --git a/versioned_docs/version-7.0.0/api/polygons.mdx b/versioned_docs/version-7.0.0/api/polygons.mdx new file mode 100644 index 00000000..6da5aa0a --- /dev/null +++ b/versioned_docs/version-7.0.0/api/polygons.mdx @@ -0,0 +1,71 @@ +--- +title: polygons +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) from an Array of Polygon coordinates. + +### Parameters + +| Name | Type | Description | +| -------------------- | ---------------------------------------------- | ------------------------------------------------------------------------- | +| coordinates | **Array\\>\>\>** | an array of Polygon coordinates | +| properties? | **Object** | an Object of key-value pairs to add as properties _(default \{\})_ | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.bbox? | **Array\** | Bounding Box Array [west, south, east, north] associated with the Feature | +| options.id? | **string \| number** | Identifier associated with the FeatureCollection | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** Polygon FeatureCollection + +
+ +### Examples + +```javascript +var polygons = turf.polygons([ + [ + [ + [-5, 52], + [-4, 56], + [-2, 51], + [-7, 54], + [-5, 52], + ], + ], + [ + [ + [-15, 42], + [-14, 46], + [-12, 41], + [-17, 44], + [-15, 42], + ], + ], +]); + +//=polygons +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { polygons } from "@turf/helpers"; +const result = polygons(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.polygons(...); +``` diff --git a/versioned_docs/version-7.0.0/api/propEach.mdx b/versioned_docs/version-7.0.0/api/propEach.mdx new file mode 100644 index 00000000..76b5f8c3 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/propEach.mdx @@ -0,0 +1,52 @@ +--- +title: propEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over properties in any GeoJSON object, similar to Array.forEach() + +### Parameters + +| Name | Type | Description | +| -------- | -------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | any GeoJSON object | +| callback | **Function** | a method that takes (currentProperties, featureIndex) | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.propEach(features, function (currentProperties, featureIndex) { + //=currentProperties + //=featureIndex +}); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { propEach } from "@turf/meta"; +const result = propEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.propEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/propReduce.mdx b/versioned_docs/version-7.0.0/api/propReduce.mdx new file mode 100644 index 00000000..1958c44e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/propReduce.mdx @@ -0,0 +1,63 @@ +--- +title: propReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce properties in any GeoJSON object into a single value, +similar to how Array.reduce works. However, in this case we lazily run +the reduction, so an array of all properties is unnecessary. + +### Parameters + +| Name | Type | Description | +| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)** | any GeoJSON object | +| callback | **Function** | a method that takes (previousValue, currentProperties, featureIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    + **\*** The value that results from the reduction. + +
+ +### Examples + +```javascript +var features = turf.featureCollection([ + turf.point([26, 37], { foo: "bar" }), + turf.point([36, 53], { hello: "world" }), +]); + +turf.propReduce( + features, + function (previousValue, currentProperties, featureIndex) { + //=previousValue + //=currentProperties + //=featureIndex + return currentProperties; + }, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { propReduce } from "@turf/meta"; +const result = propReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.propReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/pt.mdx b/versioned_docs/version-7.0.0/api/pt.mdx new file mode 100644 index 00000000..983017c2 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/pt.mdx @@ -0,0 +1,38 @@ +--- +title: pt +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Translate Properties to final Point, priorities: + +1. options.properties +1. inherent Point properties +1. dist custom properties created by NearestPointToLine + +### Parameters + +| Name | Type | Description | +| ---- | ---- | ----------- | + +### Returns + +### Installation + +```javascript +$ npm install @turf/nearest-point-to-line + +import { pt } from "@turf/nearest-point-to-line"; +const result = pt(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.pt(...); +``` diff --git a/versioned_docs/version-7.0.0/api/quadratAnalysis.mdx b/versioned_docs/version-7.0.0/api/quadratAnalysis.mdx new file mode 100644 index 00000000..9dcda8b8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/quadratAnalysis.mdx @@ -0,0 +1,74 @@ +--- +title: quadratAnalysis +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Quadrat analysis lays a set of equal-size areas(quadrat) over the study area and counts +the number of features in each quadrat and creates a frequency table. +The table lists the number of quadrats containing no features, +the number containing one feature, two features, and so on, +all the way up to the quadrat containing the most features. +The method then creates the frequency table for the random distribution, usually based on a Poisson distribution. +The method uses the distribution to calculate the probability for 0 feature occuring, +1 feature occuring, 2 features, and so on, +and lists these probabilities in the frequency table. +By comparing the two frequency tables, you can see whether the features create a pattern. +If the table for the observed distribution has more quadrats containing many features than the +table for the random distribution dose, then the features create a clustered pattern. + +It is hard to judge the frequency tables are similar or different just by looking at them. +So, we can use serval statistical tests to find out how much the frequency tables differ. +We use Kolmogorov-Smirnov test.This method calculates cumulative probabilities for both distributions, +and then compares the cumulative probabilities at each class level and selects the largest absolute difference D. +Then, the test compares D to the critical value for a confidence level you specify. +If D is greater than the critical value, the difference between the observed distribution and +the random distribution is significant. The greater the value the bigger the difference. + +Traditionally, squares are used for the shape of the quadrats, in a regular grid(square-grid). +Some researchers suggest that the quadrat size equal twice the size of mean area per feature, +which is simply the area of the study area divided by the number of features. + +### Parameters + +| Name | Type | Description | +| ------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------ | +| pointFeatureSet | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | point set to study | +| options? | **Object** | optional parameters _(default \{\})_ | +| options.studyBbox? | **bbox** | bbox representing the study area | +| options.confidenceLevel? | **number** | a confidence level. The unit is percentage . 5 means 95%, value must be in \{@link K*TABLE\} *(default 20)\_ | + +### Returns + +
    + **Object** result [QuadratAnalysisResult](QuadratAnalysisResult) + +
+ +### Examples + +```javascript +var bbox = [-65, 40, -63, 42]; +var dataset = turf.randomPoint(100, { bbox: bbox }); +var result = turf.quadratAnalysis(dataset); +``` + +### Installation + +```javascript +$ npm install @turf/quadrat-analysis + +import { quadratAnalysis } from "@turf/quadrat-analysis"; +const result = quadratAnalysis(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.quadratAnalysis(...); +``` diff --git a/versioned_docs/version-7.0.0/api/radiansToDegrees.mdx b/versioned_docs/version-7.0.0/api/radiansToDegrees.mdx new file mode 100644 index 00000000..b5865f4d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/radiansToDegrees.mdx @@ -0,0 +1,40 @@ +--- +title: radiansToDegrees +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts an angle in radians to degrees + +### Parameters + +| Name | Type | Description | +| ------- | ---------- | ---------------- | +| radians | **number** | angle in radians | + +### Returns + +
    + **number** degrees between 0 and 360 degrees + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { radiansToDegrees } from "@turf/helpers"; +const result = radiansToDegrees(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.radiansToDegrees(...); +``` diff --git a/versioned_docs/version-7.0.0/api/radiansToLength.mdx b/versioned_docs/version-7.0.0/api/radiansToLength.mdx new file mode 100644 index 00000000..6f6660ae --- /dev/null +++ b/versioned_docs/version-7.0.0/api/radiansToLength.mdx @@ -0,0 +1,42 @@ +--- +title: radiansToLength +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Convert a distance measurement (assuming a spherical Earth) from radians to a more friendly unit. +Valid units: miles, nauticalmiles, inches, yards, meters, metres, kilometers, centimeters, feet + +### Parameters + +| Name | Type | Description | +| ------------- | ---------- | --------------------------------------------------------------------------------------------------------------- | +| radians | **number** | in radians across the sphere | +| units? | **string** | can be degrees, radians, miles, inches, yards, metres, meters, kilometres, kilometers. _(default "kilometers")_ | + +### Returns + +
    + **number** distance + +
+ +### Installation + +```javascript +$ npm install @turf/helpers + +import { radiansToLength } from "@turf/helpers"; +const result = radiansToLength(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.radiansToLength(...); +``` diff --git a/versioned_docs/version-7.0.0/api/randomLineString.mdx b/versioned_docs/version-7.0.0/api/randomLineString.mdx new file mode 100644 index 00000000..80a81000 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/randomLineString.mdx @@ -0,0 +1,52 @@ +--- +title: randomLineString +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns a random [linestring](linestring). + +### Parameters + +| Name | Type | Description | +| ---------------------------- | ------------------- | -------------------------------------------------------------------------------------------------------------- | +| count? | **number** | how many geometries will be generated _(default 1)_ | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.bbox? | **Array\** | a bounding box inside of which geometries are placed. _(default [-180,-90,180,90])_ | +| options.num_vertices? | **number** | is how many coordinates each LineString will contain. _(default 10)_ | +| options.max_length? | **number** | is the maximum number of decimal degrees that a vertex can be from its predecessor _(default 0.0001)_ | +| options.max_rotation? | **number** | is the maximum number of radians that a line segment can turn from the previous segment. _(default Math.PI/8)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** GeoJSON FeatureCollection of linestrings + +
+ +### Examples + +```javascript +var lineStrings = turf.randomLineString(25, { bbox: [-180, -90, 180, 90] }); +// => lineStrings +``` + +### Installation + +```javascript +$ npm install @turf/random + +import { randomLineString } from "@turf/random"; +const result = randomLineString(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.randomLineString(...); +``` diff --git a/versioned_docs/version-7.0.0/api/randomPoint.mdx b/versioned_docs/version-7.0.0/api/randomPoint.mdx new file mode 100644 index 00000000..b0597990 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/randomPoint.mdx @@ -0,0 +1,49 @@ +--- +title: randomPoint +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns a random [point](point). + +### Parameters + +| Name | Type | Description | +| -------------------- | ------------------- | ----------------------------------------------------------------------------------- | +| count? | **number** | how many geometries will be generated _(default 1)_ | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.bbox? | **Array\** | a bounding box inside of which geometries are placed. _(default [-180,-90,180,90])_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** GeoJSON FeatureCollection of points + +
+ +### Examples + +```javascript +var points = turf.randomPoint(25, { bbox: [-180, -90, 180, 90] }); +// => points +``` + +### Installation + +```javascript +$ npm install @turf/random + +import { randomPoint } from "@turf/random"; +const result = randomPoint(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.randomPoint(...); +``` diff --git a/versioned_docs/version-7.0.0/api/randomPolygon.mdx b/versioned_docs/version-7.0.0/api/randomPolygon.mdx new file mode 100644 index 00000000..15edd903 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/randomPolygon.mdx @@ -0,0 +1,51 @@ +--- +title: randomPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns a random [polygon](polygon). + +### Parameters + +| Name | Type | Description | +| --------------------------------- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------- | +| count? | **number** | how many geometries will be generated _(default 1)_ | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.bbox? | **Array\** | a bounding box inside of which geometries are placed. _(default [-180,-90,180,90])_ | +| options.num_vertices? | **number** | is how many coordinates each LineString will contain. _(default 10)_ | +| options.max_radial_length? | **number** | is the maximum number of decimal degrees latitude or longitude that a vertex can reach out of the center of the Polygon. _(default 10)_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** GeoJSON FeatureCollection of polygons + +
+ +### Examples + +```javascript +var polygons = turf.randomPolygon(25, { bbox: [-180, -90, 180, 90] }); +// => polygons +``` + +### Installation + +```javascript +$ npm install @turf/random + +import { randomPolygon } from "@turf/random"; +const result = randomPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.randomPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/randomPosition.mdx b/versioned_docs/version-7.0.0/api/randomPosition.mdx new file mode 100644 index 00000000..9150f417 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/randomPosition.mdx @@ -0,0 +1,47 @@ +--- +title: randomPosition +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns a random position within a [box](bounding). + +### Parameters + +| Name | Type | Description | +| ------------ | ------------------- | ---------------------------------------------------------------------------------- | +| bbox? | **Array\** | a bounding box inside of which positions are placed. _(default [-180,-90,180,90])_ | + +### Returns + +
    + **Array\** Position [longitude, latitude] + +
+ +### Examples + +```javascript +var position = turf.randomPosition([-180, -90, 180, 90]); +// => position +``` + +### Installation + +```javascript +$ npm install @turf/random + +import { randomPosition } from "@turf/random"; +const result = randomPosition(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.randomPosition(...); +``` diff --git a/versioned_docs/version-7.0.0/api/rbush.mdx b/versioned_docs/version-7.0.0/api/rbush.mdx new file mode 100644 index 00000000..2743412c --- /dev/null +++ b/versioned_docs/version-7.0.0/api/rbush.mdx @@ -0,0 +1,47 @@ +--- +title: rbush +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +GeoJSON implementation of [RBush](https://github.com/mourner/rbush#rbush) spatial index. + +### Parameters + +| Name | Type | Description | +| ------------------ | ---------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| maxEntries? | **number** | defines the maximum number of entries in a tree node. 9 (used by default) is a reasonable choice for most applications. Higher value means faster insertion and slower search, and vice versa. _(default 9)_ | + +### Returns + +
    + **RBush** GeoJSON RBush + +
+ +### Examples + +```javascript +var geojsonRbush = require("geojson-rbush").default; +var tree = geojsonRbush(); +``` + +### Installation + +```javascript +$ npm install @turf/geojson-rbush + +import { rbush } from "@turf/geojson-rbush"; +const result = rbush(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.rbush(...); +``` diff --git a/versioned_docs/version-7.0.0/api/rewind.mdx b/versioned_docs/version-7.0.0/api/rewind.mdx new file mode 100644 index 00000000..5f64693f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/rewind.mdx @@ -0,0 +1,85 @@ +--- +title: rewind +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Rewind [(Multi)LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4) or [(Multi)Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) outer ring counterclockwise and inner rings clockwise (Uses [Shoelace Formula](http://en.wikipedia.org/wiki/Shoelace_formula)). + +### Parameters + +| Name | Type | Description | +| ----------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | input GeoJSON Polygon | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.reverse? | **boolean** | enable reverse winding _(default false)_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** rewind Polygon + +
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [121, -29], + [138, -29], + [138, -18], + [121, -18], + [121, -29], + ], +]); + +var rewind = turf.rewind(polygon); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var polygon = turf.polygon([ + [ + [121, -29], + [138, -29], + [138, -18], + [121, -18], + [121, -29], + ], + ]); + + var rewind = turf.rewind(polygon); + + //addToMap + var addToMap = { rewind }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/rewind + +import { rewind } from "@turf/rewind"; +const result = rewind(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.rewind(...); +``` diff --git a/versioned_docs/version-7.0.0/api/rhumbBearing.mdx b/versioned_docs/version-7.0.0/api/rhumbBearing.mdx new file mode 100644 index 00000000..ac55351d --- /dev/null +++ b/versioned_docs/version-7.0.0/api/rhumbBearing.mdx @@ -0,0 +1,74 @@ +--- +title: rhumbBearing +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) 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 + +| Name | Type | Description | +| --------------------- | -------------------------------------------------------------- | ------------------------------------------------------ | +| start | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | starting Point | +| end | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | ending Point | +| options? | **Object** | Optional parameters | +| options.final? | **boolean** | calculates the final bearing if true _(default false)_ | + +### Returns + +
    + **number** bearing from north in decimal degrees, between -180 and 180 degrees (positive clockwise) + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/rhumb-bearing + +import { rhumbBearing } from "@turf/rhumb-bearing"; +const result = rhumbBearing(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.rhumbBearing(...); +``` diff --git a/versioned_docs/version-7.0.0/api/rhumbDestination.mdx b/versioned_docs/version-7.0.0/api/rhumbDestination.mdx new file mode 100644 index 00000000..be84d716 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/rhumbDestination.mdx @@ -0,0 +1,79 @@ +--- +title: rhumbDestination +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns the destination [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2) having travelled the given distance along a Rhumb line from the +origin Point with the (varant) given bearing. + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- | +| origin | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | starting point | +| distance | **number** | distance from the starting point | +| bearing | **number** | varant bearing angle ranging from -180 to 180 degrees from north | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.properties? | **Object** | translate properties to destination point _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** Destination point. + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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"; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/rhumb-destination + +import { rhumbDestination } from "@turf/rhumb-destination"; +const result = rhumbDestination(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.rhumbDestination(...); +``` diff --git a/versioned_docs/version-7.0.0/api/rhumbDistance.mdx b/versioned_docs/version-7.0.0/api/rhumbDistance.mdx new file mode 100644 index 00000000..8f5a2a38 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/rhumbDistance.mdx @@ -0,0 +1,76 @@ +--- +title: rhumbDistance +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Calculates the distance along a rhumb line between two [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) in degrees, radians, +miles, or kilometers. + +### Parameters + +| Name | Type | Description | +| --------------------- | -------------------------------------------------------------- | ---------------------------------------------------------------------- | +| from | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | origin point | +| to | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | destination point | +| options? | **Object** | Optional parameters | +| options.units? | **string** | can be degrees, radians, miles, or kilometers _(default "kilometers")_ | + +### Returns + +
    + **number** distance between the two points + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/rhumb-distance + +import { rhumbDistance } from "@turf/rhumb-distance"; +const result = rhumbDistance(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.rhumbDistance(...); +``` diff --git a/versioned_docs/version-7.0.0/api/round.mdx b/versioned_docs/version-7.0.0/api/round.mdx new file mode 100644 index 00000000..88cc2896 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/round.mdx @@ -0,0 +1,51 @@ +--- +title: round +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Round number to precision + +### Parameters + +| Name | Type | Description | +| ----------------- | ---------- | ----------------------- | +| num | **number** | Number | +| precision? | **number** | Precision _(default 0)_ | + +### Returns + +
    + **number** rounded number + +
+ +### Examples + +```javascript +turf.round(120.4321); +//=120 + +turf.round(120.4321, 2); +//=120.43 +``` + +### Installation + +```javascript +$ npm install @turf/helpers + +import { round } from "@turf/helpers"; +const result = round(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.round(...); +``` diff --git a/versioned_docs/version-7.0.0/api/sample.mdx b/versioned_docs/version-7.0.0/api/sample.mdx new file mode 100644 index 00000000..8a128fe0 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/sample.mdx @@ -0,0 +1,71 @@ +--- +title: sample +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns a FeatureCollection with given number of [features](https://tools.ietf.org/html/rfc7946#section-3.2) at random. + +### Parameters + +| Name | Type | Description | +| ----------------- | ------------------------------------------------------------------------ | ---------------------------- | +| featurecollection | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** | set of input features | +| num | **number** | number of features to select | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)** a FeatureCollection with `n` features + +
+ +### Examples + +```javascript +var points = turf.randomPoint(100, { bbox: [-80, 30, -60, 60] }); + +var sample = turf.sample(points, 5); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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"; + }); + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/sample + +import { sample } from "@turf/sample"; +const result = sample(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.sample(...); +``` diff --git a/versioned_docs/version-7.0.0/api/sector.mdx b/versioned_docs/version-7.0.0/api/sector.mdx new file mode 100644 index 00000000..e8c61c5e --- /dev/null +++ b/versioned_docs/version-7.0.0/api/sector.mdx @@ -0,0 +1,80 @@ +--- +title: sector +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a circular sector of a circle of given radius and center [Point](https://tools.ietf.org/html/rfc7946#section-3.1.2), +between (clockwise) bearing1 and bearing2; 0 bearing is North of center point, positive clockwise. + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------- | --------------------------------------------------------------- | +| center | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | center point | +| radius | **number** | radius of the circle | +| bearing1 | **number** | angle, in decimal degrees, of the first radius of the sector | +| bearing2 | **number** | angle, in decimal degrees, of the second radius of the sector | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | miles, kilometers, degrees, or radians _(default 'kilometers')_ | +| options.steps? | **number** | number of steps _(default 64)_ | +| options.properties? | **Properties** | Translate properties to Feature Polygon _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** sector polygon + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/sector + +import { sector } from "@turf/sector"; +const result = sector(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.sector(...); +``` diff --git a/versioned_docs/version-7.0.0/api/segmentEach.mdx b/versioned_docs/version-7.0.0/api/segmentEach.mdx new file mode 100644 index 00000000..102f07ef --- /dev/null +++ b/versioned_docs/version-7.0.0/api/segmentEach.mdx @@ -0,0 +1,77 @@ +--- +title: segmentEach +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Iterate over 2-vertex line segment in any GeoJSON object, similar to Array.forEach() +(Multi)Point geometries do not contain segments therefore they are ignored during this operation. + +### Parameters + +| Name | Type | Description | +| -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON | +| callback | **Function** | a method that takes (currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [-50, 5], + [-40, -10], + [-50, -10], + [-40, 5], + [-50, 5], + ], +]); + +// Iterate over GeoJSON by 2-vertex segments +turf.segmentEach( + polygon, + function ( + currentSegment, + featureIndex, + multiFeatureIndex, + geometryIndex, + segmentIndex, + ) { + //=currentSegment + //=featureIndex + //=multiFeatureIndex + //=geometryIndex + //=segmentIndex + }, +); + +// Calculate the total number of segments +var total = 0; +turf.segmentEach(polygon, function () { + total++; +}); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { segmentEach } from "@turf/meta"; +const result = segmentEach(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.segmentEach(...); +``` diff --git a/versioned_docs/version-7.0.0/api/segmentReduce.mdx b/versioned_docs/version-7.0.0/api/segmentReduce.mdx new file mode 100644 index 00000000..64c210aa --- /dev/null +++ b/versioned_docs/version-7.0.0/api/segmentReduce.mdx @@ -0,0 +1,86 @@ +--- +title: segmentReduce +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Reduce 2-vertex line segment in any GeoJSON object, similar to Array.reduce() +(Multi)Point geometries do not contain segments therefore they are ignored during this operation. + +### Parameters + +| Name | Type | Description | +| -------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [Geometry](https://tools.ietf.org/html/rfc7946#section-3.1)** | any GeoJSON | +| callback | **Function** | a method that takes (previousValue, currentSegment, currentIndex) | +| initialValue? | **\*** | Value to use as the first argument to the first call of the callback. | + +### Returns + +
    **void**
+ +### Examples + +```javascript +var polygon = turf.polygon([ + [ + [-50, 5], + [-40, -10], + [-50, -10], + [-40, 5], + [-50, 5], + ], +]); + +// Iterate over GeoJSON by 2-vertex segments +turf.segmentReduce( + polygon, + function ( + previousSegment, + currentSegment, + featureIndex, + multiFeatureIndex, + geometryIndex, + segmentIndex, + ) { + //= previousSegment + //= currentSegment + //= featureIndex + //= multiFeatureIndex + //= geometryIndex + //= segmentIndex + return currentSegment; + }, +); + +// Calculate the total number of segments +var initialValue = 0; +var total = turf.segmentReduce( + polygon, + function (previousValue) { + previousValue++; + return previousValue; + }, + initialValue, +); +``` + +### Installation + +```javascript +$ npm install @turf/meta + +import { segmentReduce } from "@turf/meta"; +const result = segmentReduce(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.segmentReduce(...); +``` diff --git a/versioned_docs/version-7.0.0/api/shortestPath.mdx b/versioned_docs/version-7.0.0/api/shortestPath.mdx new file mode 100644 index 00000000..811c19b8 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/shortestPath.mdx @@ -0,0 +1,96 @@ +--- +title: shortestPath +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Returns the shortest [path](https://tools.ietf.org/html/rfc7946#section-3.1.4) from [start](https://tools.ietf.org/html/rfc7946#section-3.1.2) to [end](https://tools.ietf.org/html/rfc7946#section-3.1.2) without colliding with +any [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) in obstacles + +### Parameters + +| Name | Type | Description | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | +| start | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | point | +| end | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | point | +| options? | **Object** | optional parameters _(default \{\})_ | +| options.obstacles? | **[Geometry](https://tools.ietf.org/html/rfc7946#section-3.1) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2) \| [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | areas which path cannot travel | +| options.units? | **string** | unit in which resolution & minimum distance will be expressed in; it can be degrees, radians, miles, kilometers, ... _(default 'kilometers')_ | +| options.resolution? | **number** | distance between matrix points on which the path will be calculated _(default 100)_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[LineString](https://tools.ietf.org/html/rfc7946#section-3.1.4)\>** shortest path between start and end + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var start = [-5, -6]; + var end = [9, -6]; + var options = { + obstacles: turf.polygon([ + [ + [0, -7], + [5, -7], + [5, -3], + [0, -3], + [0, -7], + ], + ]).geometry, + }; + + var path = turf.shortestPath(start, end, options); + + //addToMap + var addToMap = { start, end, obstacles: options.obstacles, path }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/shortest-path + +import { shortestPath } from "@turf/shortest-path"; +const result = shortestPath(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.shortestPath(...); +``` diff --git a/versioned_docs/version-7.0.0/api/simplify.mdx b/versioned_docs/version-7.0.0/api/simplify.mdx new file mode 100644 index 00000000..f8b216eb --- /dev/null +++ b/versioned_docs/version-7.0.0/api/simplify.mdx @@ -0,0 +1,117 @@ +--- +title: simplify +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [GeoJSON](https://tools.ietf.org/html/rfc7946#section-3) object and returns a simplified version. Internally uses the 2d version of +[simplify-js](http://mourner.github.io/simplify-js/) to perform simplification using the Ramer-Douglas-Peucker algorithm. + +### Parameters + +| Name | Type | Description | +| --------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | object to be simplified | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.tolerance? | **number** | simplification tolerance _(default 1)_ | +| options.highQuality? | **boolean** | whether or not to spend more time to create a higher-quality simplification with a different algorithm _(default false)_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** a simplified GeoJSON + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/simplify + +import { simplify } from "@turf/simplify"; +const result = simplify(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.simplify(...); +``` diff --git a/versioned_docs/version-7.0.0/api/square.mdx b/versioned_docs/version-7.0.0/api/square.mdx new file mode 100644 index 00000000..63695767 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/square.mdx @@ -0,0 +1,68 @@ +--- +title: square +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a bounding box and calculates the minimum square bounding box that +would contain the input. + +### Parameters + +| Name | Type | Description | +| ---- | --------------------------------------------------------- | ------------------------------------------ | +| bbox | **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** | extent in [west, south, east, north] order | + +### Returns + +
    + **[BBox](https://tools.ietf.org/html/rfc7946#section-5)** a square surrounding `bbox` + +
+ +### Examples + +```javascript +var bbox = [-20, -20, -15, 0]; +var squared = turf.square(bbox); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [-20, -20, -15, 0]; + var squared = turf.square(bbox); + + //addToMap + var addToMap = { + bbox: turf.bboxPolygon(bbox), + squared: turf.bboxPolygon(squared), + }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/square + +import { square } from "@turf/square"; +const result = square(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.square(...); +``` diff --git a/versioned_docs/version-7.0.0/api/squareGrid.mdx b/versioned_docs/version-7.0.0/api/squareGrid.mdx new file mode 100644 index 00000000..5152b9c4 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/squareGrid.mdx @@ -0,0 +1,75 @@ +--- +title: squareGrid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Creates a square grid from a bounding box. + +### Parameters + +| Name | Type | Description | +| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | +| bbox | **Array\** | extent in [minX, minY, maxX, maxY] order | +| cellSide | **number** | of each cell, in units | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | used in calculating cellSide, can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.mask? | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it | +| options.properties? | **Object** | passed to each point of the grid _(default \{\})_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** grid a grid of polygons + +
+ +### Examples + +```javascript +var bbox = [-95, 30, -85, 40]; +var cellSide = 50; +var options = { units: "miles" }; + +var squareGrid = turf.squareGrid(bbox, cellSide, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [-95, 30, -85, 40]; + var cellSide = 50; + var options = { units: "miles" }; + + var squareGrid = turf.squareGrid(bbox, cellSide, options); + + //addToMap + var addToMap = { squareGrid }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/square-grid + +import { squareGrid } from "@turf/square-grid"; +const result = squareGrid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.squareGrid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/standardDeviationalEllipse.mdx b/versioned_docs/version-7.0.0/api/standardDeviationalEllipse.mdx new file mode 100644 index 00000000..358ae181 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/standardDeviationalEllipse.mdx @@ -0,0 +1,87 @@ +--- +title: standardDeviationalEllipse +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) and returns a standard deviational ellipse, +also known as a “directional distribution.” The standard deviational ellipse +aims to show the direction and the distribution of a dataset by drawing +an ellipse that contains about one standard deviation’s worth (~ 70%) of the +data. + +This module mirrors the functionality of [Directional Distribution](http://desktop.arcgis.com/en/arcmap/10.3/tools/spatial-statistics-toolbox/directional-distribution.htm) +in ArcGIS and the [QGIS Standard Deviational Ellipse Plugin](http://arken.nmbu.no/~havatv/gis/qgisplugins/SDEllipse/) + +**Bibliography** + +• Robert S. Yuill, “The Standard Deviational Ellipse; An Updated Tool for +Spatial Description,” _Geografiska Annaler_ 53, no. 1 (1971): 28–39, +doi:[10.2307/490885](https://doi.org/10.2307/490885). + +• Paul Hanly Furfey, “A Note on Lefever’s “Standard Deviational Ellipse,” +_American Journal of Sociology_ 33, no. 1 (1927): 94—98, +doi:[10.1086/214336](https://doi.org/10.1086/214336). + +### Parameters + +| Name | Type | Description | +| -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | GeoJSON points | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.weight? | **string** | the property name used to weight the center | +| options.steps? | **number** | number of steps for the polygon _(default 64)_ | +| options.properties? | **Object** | properties to pass to the resulting ellipse _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** an elliptical Polygon that includes approximately 1 SD of the dataset within it. + +
+ +### Examples + +```javascript +var bbox = [-74, 40.72, -73.98, 40.74]; +var points = turf.randomPoint(400, { bbox: bbox }); +var sdEllipse = turf.standardDeviationalEllipse(points); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [-74, 40.72, -73.98, 40.74]; + var points = turf.randomPoint(400, { bbox: bbox }); + var sdEllipse = turf.standardDeviationalEllipse(points); + + //addToMap + var addToMap = { points, sdEllipse }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/standard-deviational-ellipse + +import { standardDeviationalEllipse } from "@turf/standard-deviational-ellipse"; +const result = standardDeviationalEllipse(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.standardDeviationalEllipse(...); +``` diff --git a/versioned_docs/version-7.0.0/api/tag.mdx b/versioned_docs/version-7.0.0/api/tag.mdx new file mode 100644 index 00000000..8bc0e3cb --- /dev/null +++ b/versioned_docs/version-7.0.0/api/tag.mdx @@ -0,0 +1,125 @@ +--- +title: tag +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and a set of [polygons](https://tools.ietf.org/html/rfc7946#section-3.1.6) and/or [multipolygons](https://tools.ietf.org/html/rfc7946#section-3.1.7) and performs a spatial join. + +### Parameters + +| Name | Type | Description | +| -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | input points | +| polygons | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | input (multi)polygons | +| field | **string** | property in `polygons` to add to joined \{\\} features | +| outField | **string** | property in `points` in which to store joined property from `polygons` | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** points with `containingPolyId` property containing values from `polyId` + +
+ +### 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"); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/tag + +import { tag } from "@turf/tag"; +const result = tag(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.tag(...); +``` diff --git a/versioned_docs/version-7.0.0/api/tesselate.mdx b/versioned_docs/version-7.0.0/api/tesselate.mdx new file mode 100644 index 00000000..17c67c88 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/tesselate.mdx @@ -0,0 +1,85 @@ +--- +title: tesselate +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Tesselates a [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\> into a [FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\> of triangles +using [earcut](https://github.com/mapbox/earcut). + +### Parameters + +| Name | Type | Description | +| ---- | ------------------------------------------------------------------------------------------------------------------------------ | ------------------------ | +| poly | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | the polygon to tesselate | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a geometrycollection feature + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/tesselate + +import { tesselate } from "@turf/tesselate"; +const result = tesselate(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.tesselate(...); +``` diff --git a/versioned_docs/version-7.0.0/api/tin.mdx b/versioned_docs/version-7.0.0/api/tin.mdx new file mode 100644 index 00000000..92ae9c77 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/tin.mdx @@ -0,0 +1,88 @@ +--- +title: tin +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a set of [points](https://tools.ietf.org/html/rfc7946#section-3.1.2) and creates a +[Triangulated Irregular Network](http://en.wikipedia.org/wiki/Triangulated_irregular_network), +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 + +| Name | Type | Description | +| --------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | input points | +| z? | **String** | 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. | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** TIN output + +
+ +### 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"); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + // 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; + } + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/tin + +import { tin } from "@turf/tin"; +const result = tin(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.tin(...); +``` diff --git a/versioned_docs/version-7.0.0/api/toMercator.mdx b/versioned_docs/version-7.0.0/api/toMercator.mdx new file mode 100644 index 00000000..184e5add --- /dev/null +++ b/versioned_docs/version-7.0.0/api/toMercator.mdx @@ -0,0 +1,66 @@ +--- +title: toMercator +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts a WGS84 GeoJSON object into Mercator (EPSG:900913) projection + +### Parameters + +| Name | Type | Description | +| ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3) \| Position** | WGS84 GeoJSON object | +| options? | **Object** | Optional parameters | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** Projected GeoJSON + +
+ +### Examples + +```javascript +var pt = turf.point([-71, 41]); +var converted = turf.toMercator(pt); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var pt = turf.point([-71, 41]); + var converted = turf.toMercator(pt); + + //addToMap + var addToMap = { pt, converted }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/projection + +import { toMercator } from "@turf/projection"; +const result = toMercator(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.toMercator(...); +``` diff --git a/versioned_docs/version-7.0.0/api/toWgs84.mdx b/versioned_docs/version-7.0.0/api/toWgs84.mdx new file mode 100644 index 00000000..57b48b62 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/toWgs84.mdx @@ -0,0 +1,66 @@ +--- +title: toWgs84 +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Converts a Mercator (EPSG:900913) GeoJSON object into WGS84 projection + +### Parameters + +| Name | Type | Description | +| ---------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3) \| Position** | Mercator GeoJSON object | +| options? | **Object** | Optional parameters | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** Projected GeoJSON + +
+ +### Examples + +```javascript +var pt = turf.point([-7903683.846322424, 5012341.663847514]); +var converted = turf.toWgs84(pt); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var pt = turf.point([-7903683.846322424, 5012341.663847514]); + var converted = turf.toWgs84(pt); + + //addToMap + var addToMap = { pt, converted }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/projection + +import { toWgs84 } from "@turf/projection"; +const result = toWgs84(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.toWgs84(...); +``` diff --git a/versioned_docs/version-7.0.0/api/transformRotate.mdx b/versioned_docs/version-7.0.0/api/transformRotate.mdx new file mode 100644 index 00000000..11e1457f --- /dev/null +++ b/versioned_docs/version-7.0.0/api/transformRotate.mdx @@ -0,0 +1,85 @@ +--- +title: transformRotate +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point. + +### Parameters + +| Name | Type | Description | +| ---------------------- | -------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | object to be rotated | +| angle | **number** | of rotation in decimal degrees, positive clockwise | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.pivot? | **[Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | point around which the rotation will be performed _(default 'centroid')_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** the rotated GeoJSON feature + +
+ +### 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); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + 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 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/transform-rotate + +import { transformRotate } from "@turf/transform-rotate"; +const result = transformRotate(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.transformRotate(...); +``` diff --git a/versioned_docs/version-7.0.0/api/transformScale.mdx b/versioned_docs/version-7.0.0/api/transformScale.mdx new file mode 100644 index 00000000..035132b9 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/transformScale.mdx @@ -0,0 +1,84 @@ +--- +title: transformScale +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Scale a GeoJSON from a given point by a factor of scaling (ex: factor=2 would make the GeoJSON 200% larger). +If a FeatureCollection is provided, the origin point will be calculated based on each individual Feature. + +### Parameters + +| Name | Type | Description | +| ---------------------- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | GeoJSON to be scaled | +| factor | **number** | of scaling, positive values greater than 0. Numbers between 0 and 1 will shrink the geojson, numbers greater than 1 will expand it, a factor of 1 will not change the geojson. | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.origin? | **string \| [Coord](https://tools.ietf.org/html/rfc7946#section-3.1.1)** | Point from which the scaling will occur (string options: sw/se/nw/ne/center/centroid) _(default 'centroid')_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** scaled GeoJSON + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [0, 29], + [3.5, 29], + [2.5, 32], + [0, 29], + ], +]); +var scaledPoly = turf.transformScale(poly, 3); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly = turf.polygon([ + [ + [0, 29], + [3.5, 29], + [2.5, 32], + [0, 29], + ], + ]); + var scaledPoly = turf.transformScale(poly, 3); + + //addToMap + var addToMap = { poly, scaledPoly }; + scaledPoly.properties = { stroke: "#F00", "stroke-width": 4 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/transform-scale + +import { transformScale } from "@turf/transform-scale"; +const result = transformScale(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.transformScale(...); +``` diff --git a/versioned_docs/version-7.0.0/api/transformTranslate.mdx b/versioned_docs/version-7.0.0/api/transformTranslate.mdx new file mode 100644 index 00000000..397c1018 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/transformTranslate.mdx @@ -0,0 +1,86 @@ +--- +title: transformTranslate +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Moves any geojson Feature or Geometry of a specified distance along a Rhumb Line +on the provided direction angle. + +### Parameters + +| Name | Type | Description | +| ---------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | object to be translated | +| distance | **number** | length of the motion; negative values determine motion in opposite direction | +| direction | **number** | of the motion; angle from North in decimal degrees, positive clockwise | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | in which `distance` will be express; miles, kilometers, degrees, or radians _(default 'kilometers')_ | +| options.zTranslation? | **number** | length of the vertical motion, same unit of distance _(default 0)_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** the translated GeoJSON object + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [0, 29], + [3.5, 29], + [2.5, 32], + [0, 29], + ], +]); +var translatedPoly = turf.transformTranslate(poly, 100, 35); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly = turf.polygon([ + [ + [0, 29], + [3.5, 29], + [2.5, 32], + [0, 29], + ], + ]); + var translatedPoly = turf.transformTranslate(poly, 100, 35); + + //addToMap + var addToMap = { poly, translatedPoly }; + translatedPoly.properties = { stroke: "#F00", "stroke-width": 4 }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/transform-translate + +import { transformTranslate } from "@turf/transform-translate"; +const result = transformTranslate(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.transformTranslate(...); +``` diff --git a/versioned_docs/version-7.0.0/api/triangleGrid.mdx b/versioned_docs/version-7.0.0/api/triangleGrid.mdx new file mode 100644 index 00000000..ad93a530 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/triangleGrid.mdx @@ -0,0 +1,75 @@ +--- +title: triangleGrid +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a bounding box and a cell depth and returns a set of triangular [polygons](https://tools.ietf.org/html/rfc7946#section-3.1.6) in a grid. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------- | +| bbox | **Array\** | extent in [minX, minY, maxX, maxY] order | +| cellSide | **number** | dimension of each cell | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.units? | **string** | used in calculating cellSide, can be degrees, radians, miles, or kilometers _(default 'kilometers')_ | +| options.mask? | **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** | if passed a Polygon or MultiPolygon, the grid Points will be created only inside it | +| options.properties? | **Object** | passed to each point of the grid _(default \{\})_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** grid of polygons + +
+ +### Examples + +```javascript +var bbox = [-95, 30, -85, 40]; +var cellSide = 50; +var options = { units: "miles" }; + +var triangleGrid = turf.triangleGrid(bbox, cellSide, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var bbox = [-95, 30, -85, 40]; + var cellSide = 50; + var options = { units: "miles" }; + + var triangleGrid = turf.triangleGrid(bbox, cellSide, options); + + //addToMap + var addToMap = { triangleGrid }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/triangle-grid + +import { triangleGrid } from "@turf/triangle-grid"; +const result = triangleGrid(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.triangleGrid(...); +``` diff --git a/versioned_docs/version-7.0.0/api/truncate.mdx b/versioned_docs/version-7.0.0/api/truncate.mdx new file mode 100644 index 00000000..74c6bd66 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/truncate.mdx @@ -0,0 +1,72 @@ +--- +title: truncate +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a GeoJSON Feature or FeatureCollection and truncates the precision of the geometry. + +### Parameters + +| Name | Type | Description | +| --------------------------- | ------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- | +| geojson | **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** | any GeoJSON Feature, FeatureCollection, Geometry or GeometryCollection. | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.precision? | **number** | coordinate decimal precision _(default 6)_ | +| options.coordinates? | **number** | maximum number of coordinates (primarly used to remove z coordinates) _(default 3)_ | +| options.mutate? | **boolean** | allows GeoJSON input to be mutated (significant performance increase if true) _(default false)_ | + +### Returns + +
    + **[GeoJSON](https://tools.ietf.org/html/rfc7946#section-3)** layer with truncated geometry + +
+ +### Examples + +```javascript +var point = turf.point([70.46923055566859, 58.11088890802906, 1508]); +var options = { precision: 3, coordinates: 2 }; +var truncated = turf.truncate(point, options); +//=truncated.geometry.coordinates => [70.469, 58.111] +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var point = turf.point([70.46923055566859, 58.11088890802906, 1508]); + var options = { precision: 3, coordinates: 2 }; + var truncated = turf.truncate(point, options); + //=truncated.geometry.coordinates => [70.469, 58.111] + + //addToMap + var addToMap = { truncated }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/truncate + +import { truncate } from "@turf/truncate"; +const result = truncate(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.truncate(...); +``` diff --git a/versioned_docs/version-7.0.0/api/union.mdx b/versioned_docs/version-7.0.0/api/union.mdx new file mode 100644 index 00000000..8418ffda --- /dev/null +++ b/versioned_docs/version-7.0.0/api/union.mdx @@ -0,0 +1,114 @@ +--- +title: union +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes input [(Multi)Polygon(s)](https://tools.ietf.org/html/rfc7946#section-3.1.6) and returns a combined polygon. If the input polygons are not contiguous, this function returns a [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) feature. + +### Parameters + +| Name | Type | Description | +| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- | +| features | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | input Polygon features | +| options? | **Object** | Optional Parameters _(default \{\})_ | +| options.properties? | **Object** | Translate Properties to output Feature _(default \{\})_ | + +### Returns + +
    + **[Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** a combined [Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) or [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7) feature, or null if the inputs are empty + +
+ +### Examples + +```javascript +var poly1 = turf.polygon( + [ + [ + [-82.574787, 35.594087], + [-82.574787, 35.615581], + [-82.545261, 35.615581], + [-82.545261, 35.594087], + [-82.574787, 35.594087], + ], + ], + { fill: "#0f0" }, +); +var poly2 = turf.polygon( + [ + [ + [-82.560024, 35.585153], + [-82.560024, 35.602602], + [-82.52964, 35.602602], + [-82.52964, 35.585153], + [-82.560024, 35.585153], + ], + ], + { fill: "#00f" }, +); + +var union = turf.union(turf.featureCollection([poly1, poly2])); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly1 = turf.polygon( + [ + [ + [-82.574787, 35.594087], + [-82.574787, 35.615581], + [-82.545261, 35.615581], + [-82.545261, 35.594087], + [-82.574787, 35.594087], + ], + ], + { fill: "#0f0" }, + ); + var poly2 = turf.polygon( + [ + [ + [-82.560024, 35.585153], + [-82.560024, 35.602602], + [-82.52964, 35.602602], + [-82.52964, 35.585153], + [-82.560024, 35.585153], + ], + ], + { fill: "#00f" }, + ); + + var union = turf.union(turf.featureCollection([poly1, poly2])); + + //addToMap + var addToMap = { poly1, poly2, union }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/union + +import { union } from "@turf/union"; +const result = union(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.union(...); +``` diff --git a/versioned_docs/version-7.0.0/api/unkinkPolygon.mdx b/versioned_docs/version-7.0.0/api/unkinkPolygon.mdx new file mode 100644 index 00000000..3f966888 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/unkinkPolygon.mdx @@ -0,0 +1,83 @@ +--- +title: unkinkPolygon +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a kinked polygon and returns a feature collection of polygons that have no kinks. +Uses [simplepolygon](https://github.com/mclaeysb/simplepolygon) internally. + +### Parameters + +| Name | Type | Description | +| ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------- | +| geojson | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3) \| [Feature](https://tools.ietf.org/html/rfc7946#section-3.2)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6) \| [MultiPolygon](https://tools.ietf.org/html/rfc7946#section-3.1.7)\>** | GeoJSON Polygon or MultiPolygon | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** Unkinked polygons + +
+ +### Examples + +```javascript +var poly = turf.polygon([ + [ + [0, 0], + [2, 0], + [0, 2], + [2, 2], + [0, 0], + ], +]); + +var result = turf.unkinkPolygon(poly); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var poly = turf.polygon([ + [ + [0, 0], + [2, 0], + [0, 2], + [2, 2], + [0, 0], + ], + ]); + + var result = turf.unkinkPolygon(poly); + + //addToMap + var addToMap = { poly, result }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/unkink-polygon + +import { unkinkPolygon } from "@turf/unkink-polygon"; +const result = unkinkPolygon(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.unkinkPolygon(...); +``` diff --git a/versioned_docs/version-7.0.0/api/variance.mdx b/versioned_docs/version-7.0.0/api/variance.mdx new file mode 100644 index 00000000..f238c095 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/variance.mdx @@ -0,0 +1,37 @@ +--- +title: variance +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +get variance of a list + +### Parameters + +| Name | Type | Description | +| ---- | ------------------- | ----------- | +| y | **Array\** | | + +### Returns + +
    **number**
+ +### Installation + +```javascript +$ npm install @turf/moran-index + +import { variance } from "@turf/moran-index"; +const result = variance(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.variance(...); +``` diff --git a/versioned_docs/version-7.0.0/api/voronoi.mdx b/versioned_docs/version-7.0.0/api/voronoi.mdx new file mode 100644 index 00000000..d117af59 --- /dev/null +++ b/versioned_docs/version-7.0.0/api/voronoi.mdx @@ -0,0 +1,75 @@ +--- +title: voronoi +--- + +import * as turf from "turf-next"; +import ExampleMap from "@site/src/components/ExampleMap"; +import BrowserOnly from "@docusaurus/BrowserOnly"; + +### Description + +Takes a FeatureCollection of points, and a bounding box, and returns a FeatureCollection +of Voronoi polygons. + +The Voronoi algorithim used comes from the d3-voronoi package. + +### Parameters + +| Name | Type | Description | +| -------------------- | -------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- | +| points | **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Point](https://tools.ietf.org/html/rfc7946#section-3.1.2)\>** | to find the Voronoi polygons around. | +| options? | **Object** | Optional parameters _(default \{\})_ | +| options.bbox? | **Array\** | clipping rectangle, in [minX, minY, maxX, MaxY] order. _(default [-180,-85,180,-85])_ | + +### Returns + +
    + **[FeatureCollection](https://tools.ietf.org/html/rfc7946#section-3.3)\<[Polygon](https://tools.ietf.org/html/rfc7946#section-3.1.6)\>** a set of polygons, one per input point. + +
+ +### Examples + +```javascript +var options = { + bbox: [-70, 40, -60, 60], +}; +var points = turf.randomPoint(100, options); +var voronoiPolygons = turf.voronoi(points, options); +``` + +export function Map0() { + "use strict"; + + // jsdoc example start + var options = { + bbox: [-70, 40, -60, 60], + }; + var points = turf.randomPoint(100, options); + var voronoiPolygons = turf.voronoi(points, options); + + //addToMap + var addToMap = { voronoiPolygons, points }; + // jsdoc example end + + return ; +} + + +{() => } + +### Installation + +```javascript +$ npm install @turf/voronoi + +import { voronoi } from "@turf/voronoi"; +const result = voronoi(...); +``` + +```javascript +$ npm install @turf/turf + +import * as turf from "@turf/turf"; +const result = turf.voronoi(...); +``` diff --git a/versioned_docs/version-7.0.0/contributing.md b/versioned_docs/version-7.0.0/contributing.md new file mode 100644 index 00000000..22b3eda1 --- /dev/null +++ b/versioned_docs/version-7.0.0/contributing.md @@ -0,0 +1,160 @@ +# Contributing + +### :bug: [How to report a bug](http://polite.technology/reportabug.html) + +## Please note + +The high-level structure of Turf is undergoing discussion at [#1428](https://github.com/Turfjs/turf/issues/1428). Currently (June 2018), there is a partial conversion to Typescript, and the contribution documentation does not completely reflect the current status. + +## How To Contribute + +- Most work happens in sub modules. These are found in the `packages` directory prefixed with "turf-". +- If you would like to propose a new feature, open an issue in Turfjs/turf. +- Always include tests. We use [tape](https://github.com/substack/tape). +- Turf modules are small, containing a single exported function. +- GeoJSON is the lingua franca of Turf. It should be used as the data structure for anything that can be represented as geography. +- Avoid large dependencies at all costs. +- Turf is used in a wide range of places. Make sure that your code can run in the browser (ie: don't make calls to external services, don't hit the filesystem, etc.). +- The `README.md` files in `packages/turf-` are automatically generated from the [JSDocs](https://jsdoc.app) of the `index.js`. Please modify the JSDocs instead of modifying the `README.md` files directly. Then update/create the `README.md` executing [`./scripts/generate-readmes`](https://github.com/Turfjs/turf/blob/master/scripts/generate-readmes) or runing `npm run docs` from the root TurfJS directory. +- Finally run `npm test` from the project root folder to run all the tests required for deploying the project. + +## Code Style + +To ensure code style, at the `turf` root level run + +```sh +$ npm run lint +``` + +- Follow the [AirBNB JavaScript code style](https://github.com/airbnb/javascript). +- Turf aims to use ES5 features where rational. We do not use ES6 features. + +## Structure of a turf module + +``` +turf- +│ index.js +│ index.d.ts +│ bench.js +│ test.js +│ types.ts +│ package.json +│ README.md +│ LICENSE +│ +└───test + │ + ├───in + │ points.geojson + │ + └───out + points.geojson +``` + +To get started with a new module navigate to the root directory and run + +```sh +$ node ./scripts/create-new-module +``` + +it will create a new folder inside `packages` with a simple boilerplate for your module. + +- `index.js` - This file contains, in order, the various modules you need to + import, the [JSDocs](https://jsdoc.app) documentation, and, finally, the + single exported function that the module provides. For more on the types + supported in the documentation, see… +- `index.d.ts` - This is a [TypeScript](https://www.typescriptlang.org/) file + that describes your function’s signature. For more on the types supported in + TypeScript, see… +- `bench.js` - This file uses [Benchmark](https://benchmarkjs.com/) to time + your function. +- `test.js` - This file includes your [tape](https://github.com/substack/tape) + tests. We prefer dynamic testing built from GeoJSON files placed in + `./test/in` that are subsequently written to `./test/out` if your `REGEN` + [environment variable is set](https://askubuntu.com/a/58828) to `true`. If + `REGEN` is set to a different value, then running `npm t` will compare the + output of the tests to the files already present in `./test/out`. +- `types.ts` - A file that lists the custom TypeScript types used in + `index.d.ts`. +- `package.json` - The [node](http://nodejs.org) metadata container file. + Modules imported in `index.js` should be listed here under `dependencies`, + and modules used in `test.js` and/or `bench.js` should be listed under + `devDependencies`. `npm install` looks to this file to install dependencies + in `./node_modules`. +- `README.md` - This README is generated _automatically_ by running `npm run +docs` from the project root level. **DO NOT edit this file**. +- `LICENCE` - Like the README, this file should not be edited. +- `test/` - This directory holds the GeoJSON files that provide data for + dynamic tests (in `./test/in`) and the results of the tests (in + `./test/out`). The files in `./test/out` should **not** be edited by hand. + They should be generated dynamically by [setting the environment + variable](https://askubuntu.com/a/58828) `REGEN` to `true`, and then the + tests should be checked against these files by setting `REGEN` to some other + value. The resulting out-files can be drag-dropped into + [geojson.io](http://geojson.io) to see, visually, if the module is behaving + appropriately. + +## Publishing + +Install lerna: + +```bash +$ npm install -g lerna@2.0.0-beta.34 +``` + +Publish a test release: + +```bash +$ lerna publish --canary +``` + +## Documentation + +To update TurfJS's Documentation (README.md) use the following `npm run docs`: + +- **inside a module:** will only generate the docs of that module. +- **main folder:** will generate docs for all modules. + +### Examples + +**Only builds docs for `@turf/center`** + +```bash +$ cd ./turf/packages/turf-center +$ npm run docs + +> @turf/center@5.0.4 docs /Users/mac/Github/turf/packages/turf-center +> node ../../scripts/generate-readmes + +Building Docs: @turf/center +``` + +**Builds docs for all modules** + +```bash +$ cd ./turf +$ npm run docs +> @5.0.0 docs /Users/mac/Github/turf +> node ./scripts/generate-readmes + +Building Docs: @turf/along +Building Docs: @turf/area +Building Docs: @turf/bbox-clip +Building Docs: @turf/bbox-polygon +Building Docs: @turf/bbox +Building Docs: @turf/bearing +Building Docs: @turf/bezier-spline +Building Docs: @turf/boolean-clockwise +.... +``` + +## Other Dependencies + +- Turf uses [Yarn](https://yarnpkg.com) and [lerna](https://lerna.js.org) during the testing, packaging and publishing process. + - Lerna will be automatically installed when you run `npm install` in the root directory. + - Yarn will need to be installed on your computer, installers are available via the yarn website. + +## Financial contributions + +We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/turf). +Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed. diff --git a/versioned_docs/version-7.0.0/getting-started.md b/versioned_docs/version-7.0.0/getting-started.md new file mode 100644 index 00000000..f64e153d --- /dev/null +++ b/versioned_docs/version-7.0.0/getting-started.md @@ -0,0 +1,110 @@ +--- +sidebar_position: 2 +--- + +# Getting started + +How you add Turf to your project will dependend on your environment and tooling but here are some guidelines to get you started. + +The source of truth for published versions of Turf is [NPM](https://www.npmjs.com/package/@turf/turf?activeTab=versions). You are welcome to use other providers that republish these packages. + +## Installation + +### In Node.js + +```bash +# get all of turf +npm install @turf/turf + +# or get individual packages +npm install @turf/helpers +npm install @turf/buffer +``` + +As of v7, both CommonJS and ESM bundles are included. + +### In browser + +Whether downloading locally, or including a 3rd party version of turf directly, there are multiple CDN's to choose from and each has a URL scheme that allows you to specify what version you want, with some flexibility. Structure your URL as appropriate for your needs: + +- [jsdelivr](https://www.jsdelivr.com/) + - browse: https://www.jsdelivr.com/package/npm/@turf/turf + - latest within major version: https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js + - latest within minor version: https://cdn.jsdelivr.net/npm/@turf/turf@7.0/turf.min.js + - specific version: https://cdn.jsdelivr.net/npm/@turf/turf@7.0.0/turf.min.js +- [unpkg](https://www.unpkg.com/) + - browse: https://unpkg.com/browse/@turf/turf@7.0.0/ + - latest within major version: https://unpkg.com/@turf/turf@^7/turf.min.js + - latest within minor version: https://unpkg.com/@turf/turf@^7.0/turf.min.js + - specific version: https://unpkg.com/@turf/turf@7.0.0/turf.min.js + +For example, download the [latest minified version 7](https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js), and include it in a script tag. This will expose a global variable named `turf`. + +```html + +``` + +You can also include it directly from a CDN. This example specifies the latest version within v7. + +```html + +``` + +It is not recommended to use a CDN URL that gives you the `latest` bleeding edge version of Turf, especially in a production app. There are breaking changes to turf functions between major versions that can leave your app in a broken state because it always gives your browser users the latest version. + +## TypeScript + +TypeScript definitions are included and exported by each Turf module, except for GeoJSON type definitions (e.g. `Polygon`, `FeatureCollection`) which are provided by the [@types/geojson](https://www.npmjs.com/package/@types/geojson) package. Turf does not re-export these type definitionas. If you need them, you can import and use them directly, e.g. `import { Polygon, FeatureCollection } from 'geojson'`. You may need to install the `@types/geojson` package first. + +## Other languages + +Ports of Turf.js are available in: + +- [Java](https://github.com/mapbox/mapbox-java/tree/master/services-turf/src/main/java/com/mapbox/turf) (Android, Java SE) + - > [The current to-do list for porting to Java](https://github.com/mapbox/mapbox-java/blob/master/docs/turf-port.md) +- [Swift](https://github.com/mapbox/turf-swift/) (iOS, macOS, tvOS, watchOS, Linux) + - > Turf for Swift is **experimental** and its public API is subject to change. Please use with care. +- [Dart/Flutter](https://github.com/dartclub/turf_dart) (Dart Web, Dart Native; Flutter for iOS, Android, macOS, Windows, Linux, Web) + - > The Turf for Dart port is still in progress, the implementation status can be found in the [README](https://github.com/dartclub/turf_dart#components). + +--- + +## Data in Turf + +Turf uses GeoJSON for all geographic data. Turf expects the data to be standard WGS84 longitude, latitude coordinates. Check out geojson.io for a tool to easily create this data. + +> **NOTE:** Turf expects data in (longitude, latitude) order per the GeoJSON standard. + +Most Turf functions work with GeoJSON features. These are pieces of data that represent a collection of properties (ie: population, elevation, zipcode, etc.) along with a geometry. GeoJSON has several geometry types such as: + +- Point +- LineString +- Polygon + +Turf provides a few geometry functions of its own. These are nothing more than simple (and optional) wrappers that output plain old GeoJSON. For example, these two methods of creating a point are functionally equivalent: + +```js +// Note order: longitude, latitude. +var point1 = turf.point([-73.988214, 40.749128]); + +var point2 = { + type: "Feature", + geometry: { + type: "Point", + // Note order: longitude, latitude. + coordinates: [-73.988214, 40.749128], + }, + properties: {}, +}; +``` + +## Browser support + +Turf packages are compiled to target ES2017. However, the browser version of @turf/turf is transpiled to also include support for IE11. If you are using these packages and need to target IE11, please transpile the following packages as part of your build: + +``` +@turf/* +robust-predicates +rbush +tinyqueue +``` diff --git a/versioned_docs/version-7.0.0/intro.md b/versioned_docs/version-7.0.0/intro.md new file mode 100644 index 00000000..4c5218dd --- /dev/null +++ b/versioned_docs/version-7.0.0/intro.md @@ -0,0 +1,51 @@ +--- +sidebar_position: 1 +--- + +# Introduction + +**_A modular geospatial engine written in JavaScript_** + +--- + +[Turf](https://turfjs.org) is a [JavaScript library](https://en.wikipedia.org/wiki/JavaScript_library) for [spatial analysis](https://en.wikipedia.org/wiki/Spatial_analysis). It includes traditional spatial operations, helper functions for creating [GeoJSON](https://geojson.org) data, and data classification and statistics tools. Turf can be added to your website as a client-side plugin, or you can [run Turf server-side](https://www.npmjs.com/package/@turf/turf) with [Node.js](https://nodejs.org/) (see below). + +[![GitHub Actions Status](https://github.com/Turfjs/turf/actions/workflows/turf.yml/badge.svg)](https://github.com/Turfjs/turf/actions/workflows/turf.yml/badge.svg) +[![Version Badge][npm-img]][npm-url] +[![Gitter chat][gitter-img]][gitter-url] +[![Backers on Open Collective][oc-backer-badge]](#backers) +[![Sponsors on Open Collective][oc-sponsor-badge]](#sponsors) [![Coverage Status](https://coveralls.io/repos/github/Turfjs/turf/badge.svg)](https://coveralls.io/github/Turfjs/turf) + +[npm-img]: https://img.shields.io/npm/v/@turf/turf.svg +[npm-url]: https://www.npmjs.com/package/@turf/turf +[gitter-img]: https://badges.gitter.im/Turfjs/turf.svg +[gitter-url]: https://gitter.im/Turfjs/turf +[oc-backer-badge]: https://opencollective.com/turf/backers/badge.svg +[oc-sponsor-badge]: https://opencollective.com/turf/sponsors/badge.svg + +## Contributors + +This project exists thanks to all the people who contribute. If you are interested in helping, check out the [Contributing Guide](contributing.md). + + + +## Backers + +Thank you to all our backers! 🙏 [[Become a backer](https://opencollective.com/turf#backer)] + + + +## Sponsors + +Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [[Become a sponsor](https://opencollective.com/turf#sponsor)] + + + + + + + + + + + diff --git a/versioned_docs/version-7.0.0/upgrade-guide.md b/versioned_docs/version-7.0.0/upgrade-guide.md new file mode 100644 index 00000000..fa55fe70 --- /dev/null +++ b/versioned_docs/version-7.0.0/upgrade-guide.md @@ -0,0 +1,50 @@ +--- +sidebar_position: 3 +--- + +# Upgrade Guide + +When upgrading to a newer version of Turf, see the [CHANGELOG](https://github.com/Turfjs/turf/blob/master/CHANGELOG.md) and [release notes](https://github.com/Turfjs/turf/releases) for any breaking changes. If you are getting errors after upgrade, look to see if the [API docs](https://turfjs.org) have changed for your functions between versions and migrate them as appropriate. + +How you upgrade Turf will depend on your specific environment and tooling. Here are some guidelines to get you started. + +The source of truth for published versions of Turf is [NPM](https://www.npmjs.com/package/@turf/turf?activeTab=versions). You are welcome to use other providers that republish these packages. + +## In Node.js + +```bash +# If you use the all-inclusive turf library +npm update --save @turf/turf + +# if you use the smaller individual turf packages +npm update --save @turf/helpers @turf/buffer +``` + +As of v7, both CommonJS and ESM bundles are included. + +## In browser + +Whether downloading locally, or including a 3rd party version of turf directly, there are multiple CDN's to choose from and each has a URL scheme that allows you to specify what version you want, with some flexibility. Structure your URL as appropriate for your needs: + +- [jsdelivr](https://www.jsdelivr.com/) + - browse: https://www.jsdelivr.com/package/npm/@turf/turf + - latest within major version: https://cdn.jsdelivr.net/npm/@turf/turf@7/turf.min.js + - latest within minor version: https://cdn.jsdelivr.net/npm/@turf/turf@7.0/turf.min.js + - specific version: https://cdn.jsdelivr.net/npm/@turf/turf@7.0.0/turf.min.js +- [unpkg](https://www.unpkg.com/) + - browse: https://unpkg.com/browse/@turf/turf@7.0.0/ + - latest within major version: https://unpkg.com/@turf/turf@^7/turf.min.js + - latest within minor version: https://unpkg.com/@turf/turf@^7.0/turf.min.js + - specific version: https://unpkg.com/@turf/turf@7.0.0/turf.min.js + +Here's an example of migrating from Turf 6.x to 7.x + +```html + +``` +becomes +```html + +``` + +It is not recommended to use a CDN URL that always gives you the `latest` bleeding edge version of Turf, especially in a production app. There are breaking changes to turf functions between major versions that can leave your app in a broken state. diff --git a/versioned_sidebars/version-7.0.0-sidebars.json b/versioned_sidebars/version-7.0.0-sidebars.json new file mode 100644 index 00000000..4b4b527d --- /dev/null +++ b/versioned_sidebars/version-7.0.0-sidebars.json @@ -0,0 +1,315 @@ +{ + "docsSidebar": [ + { + "type": "doc", + "id": "intro" + }, + { + "type": "doc", + "id": "getting-started" + }, + { + "type": "doc", + "id": "upgrade-guide" + }, + { + "type": "doc", + "id": "contributing" + } + ], + "apiSidebar": [ + { + "type": "category", + "label": "Measurement", + "collapsed": false, + "items": [ + "api/along", + "api/area", + "api/bbox", + "api/bboxPolygon", + "api/bearing", + "api/center", + "api/centerOfMass", + "api/centroid", + "api/destination", + "api/distance", + "api/envelope", + "api/greatCircle", + "api/length", + "api/midpoint", + "api/pointOnFeature", + "api/pointToLineDistance", + "api/polygonTangents", + "api/rhumbBearing", + "api/rhumbDestination", + "api/rhumbDistance", + "api/square" + ] + }, + { + "type": "category", + "label": "Coordinate Mutation", + "collapsed": false, + "items": [ + "api/cleanCoords", + "api/flip", + "api/rewind", + "api/round", + "api/truncate" + ] + }, + { + "type": "category", + "label": "Transformation", + "collapsed": false, + "items": [ + "api/bboxClip", + "api/bezierSpline", + "api/buffer", + "api/circle", + "api/clone", + "api/concave", + "api/convex", + "api/difference", + "api/dissolve", + "api/intersect", + "api/lineOffset", + "api/polygonSmooth", + "api/simplify", + "api/tesselate", + "api/transformRotate", + "api/transformScale", + "api/transformTranslate", + "api/union", + "api/voronoi" + ] + }, + { + "type": "category", + "label": "Feature Conversion", + "collapsed": false, + "items": [ + "api/combine", + "api/explode", + "api/flatten", + "api/lineToPolygon", + "api/polygonToLine", + "api/polygonize" + ] + }, + { + "type": "category", + "label": "Misc", + "collapsed": false, + "items": [ + "api/kinks", + "api/lineArc", + "api/lineChunk", + "api/lineIntersect", + "api/lineOverlap", + "api/lineSegment", + "api/lineSlice", + "api/lineSliceAlong", + "api/lineSplit", + "api/mask", + "api/nearestPointOnLine", + "api/sector", + "api/shortestPath", + "api/unkinkPolygon" + ] + }, + { + "type": "category", + "label": "Helper", + "collapsed": false, + "items": [ + "api/feature", + "api/featureCollection", + "api/geometryCollection", + "api/lineString", + "api/multiLineString", + "api/multiPoint", + "api/multiPolygon", + "api/point", + "api/polygon" + ] + }, + { + "type": "category", + "label": "Random", + "collapsed": false, + "items": [ + "api/randomLineString", + "api/randomPoint", + "api/randomPolygon", + "api/randomPosition" + ] + }, + { + "type": "category", + "label": "Data", + "collapsed": false, + "items": [ + "api/sample" + ] + }, + { + "type": "category", + "label": "Interpolation", + "collapsed": false, + "items": [ + "api/interpolate", + "api/isobands", + "api/isolines", + "api/planepoint", + "api/tin" + ] + }, + { + "type": "category", + "label": "Joins", + "collapsed": false, + "items": [ + "api/pointsWithinPolygon", + "api/tag" + ] + }, + { + "type": "category", + "label": "Grids", + "collapsed": false, + "items": [ + "api/hexGrid", + "api/pointGrid", + "api/squareGrid", + "api/triangleGrid" + ] + }, + { + "type": "category", + "label": "Classification", + "collapsed": false, + "items": [ + "api/nearestPoint" + ] + }, + { + "type": "category", + "label": "Aggregation", + "collapsed": false, + "items": [ + "api/clustersDbscan", + "api/clustersKmeans", + "api/collect" + ] + }, + { + "type": "category", + "label": "Meta", + "collapsed": false, + "items": [ + "api/clusterEach", + "api/clusterReduce", + "api/coordAll", + "api/coordEach", + "api/coordReduce", + "api/featureEach", + "api/featureReduce", + "api/flattenEach", + "api/flattenReduce", + "api/geomEach", + "api/geomReduce", + "api/getCluster", + "api/getCoord", + "api/getCoords", + "api/getGeom", + "api/getType", + "api/propEach", + "api/propReduce", + "api/segmentEach", + "api/segmentReduce" + ] + }, + { + "type": "category", + "label": "Assertions", + "collapsed": false, + "items": [ + "api/collectionOf", + "api/containsNumber", + "api/featureOf", + "api/geojsonType" + ] + }, + { + "type": "category", + "label": "Booleans", + "collapsed": false, + "items": [ + "api/booleanClockwise", + "api/booleanConcave", + "api/booleanContains", + "api/booleanCrosses", + "api/booleanDisjoint", + "api/booleanEqual", + "api/booleanOverlap", + "api/booleanParallel", + "api/booleanPointInPolygon", + "api/booleanPointOnLine", + "api/booleanTouches", + "api/booleanWithin" + ] + }, + { + "type": "category", + "label": "Unit Conversion", + "collapsed": false, + "items": [ + "api/bearingToAzimuth", + "api/convertArea", + "api/convertLength", + "api/degreesToRadians", + "api/lengthToDegrees", + "api/lengthToRadians", + "api/radiansToDegrees", + "api/radiansToLength", + "api/toMercator", + "api/toWgs84" + ] + }, + { + "type": "category", + "label": "Other", + "collapsed": false, + "items": [ + "api/angle", + "api/booleanIntersects", + "api/booleanValid", + "api/centerMean", + "api/centerMedian", + "api/directionalMean", + "api/distanceWeight", + "api/ellipse", + "api/findPoint", + "api/findSegment", + "api/geometry", + "api/isNumber", + "api/isObject", + "api/lineEach", + "api/lineReduce", + "api/lineStrings", + "api/mean", + "api/moranIndex", + "api/nearestPointToLine", + "api/pNormDistance", + "api/points", + "api/polygons", + "api/pt", + "api/quadratAnalysis", + "api/rbush", + "api/standardDeviationalEllipse", + "api/variance" + ] + } + ] +} diff --git a/versions.json b/versions.json index cd6f8ee4..23b234f6 100644 --- a/versions.json +++ b/versions.json @@ -1,3 +1,4 @@ [ + "7.0.0", "6.5.0" ]