Skip to content

Commit

Permalink
Generating README.md files based on updated source that now includes …
Browse files Browse the repository at this point in the history
…JSDoc for internal types and constants e.g. Units. Also synced up some out of data JSDoc types with what is in the code.
  • Loading branch information
smallsaucepan committed Oct 5, 2024
1 parent 2294677 commit f779fa5
Show file tree
Hide file tree
Showing 19 changed files with 507 additions and 577 deletions.
8 changes: 3 additions & 5 deletions packages/turf-along/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t

### Parameters

* `line` **[Feature][3]<[LineString][1]>** input line
* `line` **([Feature][3]<[LineString][1]> | [LineString][1])** input line
* `distance` **[number][4]** distance along the line
* `options` **[Object][5]?** Optional parameters
* `options` **[Object][5]?** Optional parameters (optional, default `{}`)

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

### Examples

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

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

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

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

---
Expand Down
12 changes: 6 additions & 6 deletions packages/turf-bbox-polygon/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Takes a bbox and returns an equivalent [polygon][1].
* `bbox` **[BBox][2]** extent in \[minX, minY, maxX, maxY] order
* `options` **[Object][3]** Optional parameters (optional, default `{}`)

* `options.properties` **Properties** Translate properties to Polygon (optional, default `{}`)
* `options.id` **([string][4] | [number][5])** Translate Id to Polygon (optional, default `{}`)
* `options.properties` **[GeoJsonProperties][4]** Translate properties to Polygon (optional, default `{}`)
* `options.id` **([string][5] | [number][6])** Translate Id to Polygon (optional, default `{}`)

### Examples

Expand All @@ -25,19 +25,19 @@ var poly = turf.bboxPolygon(bbox);
var addToMap = [poly]
```

Returns **[Feature][6]<[Polygon][1]>** a Polygon representation of the bounding box
Returns **[Feature][4]<[Polygon][1]>** a Polygon representation of the bounding box

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

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

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

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

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

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

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

Expand Down
53 changes: 38 additions & 15 deletions packages/turf-clusters-dbscan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,38 @@

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

## Dbscan

Point classification within the cluster.

Type: (`"core"` | `"edge"` | `"noise"`)

## DbscanProps

**Extends GeoJsonProperties**

Properties assigned to each clustered point.

Type: [object][1]

### Properties

* `dbscan` **[Dbscan][2]?** type of point it has been classified as
* `cluster` **[number][3]?** associated clusterId

## clustersDbscan

Takes a set of [points][1] and partition them into clusters according to [https://en.wikipedia.org/wiki/DBSCAN][2] data clustering algorithm.
Takes a set of [points][4] and partition them into clusters according to [DBSCAN's][5] data clustering algorithm.

### Parameters

* `points` **[FeatureCollection][3]<[Point][1]>** to be clustered
* `maxDistance` **[number][4]** Maximum Distance between any point of the cluster to generate the clusters (kilometers by default, see options)
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
* `points` **[FeatureCollection][6]<[Point][4]>** to be clustered
* `maxDistance` **[number][3]** Maximum Distance between any point of the cluster to generate the clusters (kilometers by default, see options)
* `options` **[Object][1]** Optional parameters (optional, default `{}`)

* `options.units` **[string][6]** in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
* `options.mutate` **[boolean][7]** Allows GeoJSON input to be mutated (optional, default `false`)
* `options.minPoints` **[number][4]** Minimum number of points to generate a single cluster,
* `options.units` **[string][7]** in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers (optional, default `"kilometers"`)
* `options.mutate` **[boolean][8]** Allows GeoJSON input to be mutated (optional, default `false`)
* `options.minPoints` **[number][3]** Minimum number of points to generate a single cluster,
points which do not meet this requirement will be classified as an 'edge' or 'noise'. (optional, default `3`)

### Examples
Expand All @@ -29,22 +48,26 @@ var clustered = turf.clustersDbscan(points, maxDistance);
var addToMap = [clustered];
```

Returns **[FeatureCollection][3]<[Point][1]>** Clustered Points with an additional two properties associated to each Feature:* {number} cluster - the associated clusterId
Returns **[FeatureCollection][6]<[Point][4], [DbscanProps][9]>** 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')

[1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
[1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

[2]: #dbscan

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

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

[3]: https://tools.ietf.org/html/rfc7946#section-3.3
[5]: https://en.wikipedia.org/wiki/DBSCAN

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number
[6]: https://tools.ietf.org/html/rfc7946#section-3.3

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

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

[7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
[9]: #dbscanprops

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

Expand Down
23 changes: 11 additions & 12 deletions packages/turf-dissolve/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@

## dissolve

Dissolves a FeatureCollection of [polygon][1] features, filtered by an optional property name:value.
Note that [mulitpolygon][2] features within the collection are not supported
Dissolves a FeatureCollection of [Polygon][1] features, filtered by an optional property name:value.
Note that [MultiPolygon][2] features within the collection are not supported

### Parameters

* `featureCollection` **[FeatureCollection][3]<[Polygon][4]>** input feature collection to be dissolved
* `options` **[Object][5]** Optional parameters (optional, default `{}`)
* `fc` **[FeatureCollection][3]<[Polygon][1]>**&#x20;
* `options` **[Object][4]** Optional parameters (optional, default `{}`)

* `options.propertyName` **[string][6]?** features with the same `propertyName` value will be dissolved.
* `options.propertyName` **[string][5]?** features with the same `propertyName` value will be dissolved.
* `featureCollection` **[FeatureCollection][3]<[Polygon][1]>** input feature collection to be dissolved

### Examples

Expand All @@ -29,19 +30,17 @@ var dissolved = turf.dissolve(features, {propertyName: 'combine'});
var addToMap = [features, dissolved]
```

Returns **[FeatureCollection][3]<[Polygon][4]>** a FeatureCollection containing the dissolved polygons
Returns **[FeatureCollection][3]<[Polygon][1]>** a FeatureCollection containing the dissolved polygons

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

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

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

[4]: https://tools.ietf.org/html/rfc7946#section-3.1.6
[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object

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

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

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

Expand Down
165 changes: 1 addition & 164 deletions packages/turf-geojson-rbush/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ tree.fromJSON(exported)

Returns **RBush** GeoJSON RBush

## rbush
## geojsonRbush

GeoJSON implementation of [RBush][13] spatial index.

Expand All @@ -185,169 +185,6 @@ var tree = geojsonRbush();

Returns **RBush** GeoJSON RBush

### insert

[insert][1]

#### Parameters

* `feature` **[Feature][2]** insert single GeoJSON Feature

#### Examples

```javascript
var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);
tree.insert(poly)
```

Returns **RBush** GeoJSON RBush

### load

[load][3]

#### Parameters

* `features` **([FeatureCollection][4] | [Array][5]<[Feature][2]>)** load entire GeoJSON FeatureCollection

#### Examples

```javascript
var polys = turf.polygons([
[[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]],
[[[-93, 32], [-83, 32], [-83, 39], [-93, 39], [-93, 32]]]
]);
tree.load(polys);
```

Returns **RBush** GeoJSON RBush

### remove

[remove][6]

#### Parameters

* `feature` **[Feature][2]** remove single GeoJSON Feature
* `equals` **[Function][7]** Pass a custom equals function to compare by value for removal.

#### Examples

```javascript
var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);

tree.remove(poly);
```

Returns **RBush** GeoJSON RBush

### clear

[clear][6]

#### Examples

```javascript
tree.clear()
```

Returns **RBush** GeoJSON Rbush

### search

[search][8]

#### Parameters

* `geojson` **([BBox][9] | [FeatureCollection][4] | [Feature][2])** search with GeoJSON

#### Examples

```javascript
var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);

tree.search(poly);
```

Returns **[FeatureCollection][4]** all features that intersects with the given GeoJSON.

### collides

[collides][10]

#### Parameters

* `geojson` **([BBox][9] | [FeatureCollection][4] | [Feature][2])** collides with GeoJSON

#### Examples

```javascript
var poly = turf.polygon([[[-78, 41], [-67, 41], [-67, 48], [-78, 48], [-78, 41]]]);

tree.collides(poly);
```

Returns **[boolean][11]** true if there are any items intersecting the given GeoJSON, otherwise false.

### all

[all][8]

#### Examples

```javascript
tree.all()
```

Returns **[FeatureCollection][4]** all the features in RBush

### toJSON

[toJSON][12]

#### Examples

```javascript
var exported = tree.toJSON()
```

Returns **any** export data as JSON object

### fromJSON

[fromJSON][12]

#### Parameters

* `json` **any** import previously exported data

#### Examples

```javascript
var exported = {
"children": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [110, 50]
},
"properties": {},
"bbox": [110, 50, 110, 50]
}
],
"height": 1,
"leaf": true,
"minX": 110,
"minY": 50,
"maxX": 110,
"maxY": 50
}
tree.fromJSON(exported)
```

Returns **RBush** GeoJSON RBush

[1]: https://github.com/mourner/rbush#data-format

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

0 comments on commit f779fa5

Please sign in to comment.