Skip to content

Commit e7227f5

Browse files
Preliminary improvements to documentation, esp internal types e.g. Units (#2727)
* Added JSDoc for internal types and constants e.g. Unts and earthRadius. Minimal other changes to bring JSDoc types into line with code types. Added GeoJsonProperties to documentation.yml for type linking. * Generated README.md files based on updated source that now includes JSDoc for internal types and constants e.g. Units. Also synced up some out of data JSDoc types with what is in the code. * Switched the structure of documentation.yml to be more traditionally nested. We'll use this new structure from the turf-www repo to generate the website documentation in a more robust manner. * For some reason leaving this function documented as the default (geojsonRbush) causes @turf/turf last-checks to fail. Specifically defining it as rbush like it used to be, except with the @function tag rather than @name.
1 parent 90e91a3 commit e7227f5

File tree

132 files changed

+1147
-933
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

132 files changed

+1147
-933
lines changed

documentation.yml

Lines changed: 160 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,166 @@
11
toc:
2-
- name: Measurement
3-
- along
4-
- area
5-
- bbox
6-
- bboxPolygon
7-
- bearing
8-
- center
9-
- centerOfMass
10-
- centroid
11-
- destination
12-
- distance
13-
- envelope
14-
- length
15-
- midpoint
16-
- pointOnFeature
17-
- polygonTangents
18-
- pointToLineDistance
19-
- rhumbBearing
20-
- rhumbDestination
21-
- rhumbDistance
22-
- square
23-
- greatCircle
24-
- name: Coordinate Mutation
25-
- cleanCoords
26-
- flip
27-
- rewind
28-
- round
29-
- truncate
30-
- name: Transformation
31-
- bboxClip
32-
- bezierSpline
33-
- buffer
34-
- circle
35-
- clone
36-
- concave
37-
- convex
38-
- difference
39-
- dissolve
40-
- intersect
41-
- lineOffset
42-
- polygonSmooth
43-
- simplify
44-
- tesselate
45-
- transformRotate
46-
- transformTranslate
47-
- transformScale
48-
- union
49-
- voronoi
50-
- name: Feature Conversion
51-
- combine
52-
- explode
53-
- flatten
54-
- lineToPolygon
55-
- polygonize
56-
- polygonToLine
57-
- name: Misc
58-
- kinks
59-
- lineArc
60-
- lineChunk
61-
- lineIntersect
62-
- lineOverlap
63-
- lineSegment
64-
- lineSlice
65-
- lineSliceAlong
66-
- lineSplit
67-
- mask
68-
- nearestPointOnLine
69-
- sector
70-
- shortestPath
71-
- unkinkPolygon
72-
- name: Helper
73-
- featureCollection
74-
- feature
75-
- geometryCollection
76-
- lineString
77-
- multiLineString
78-
- multiPoint
79-
- multiPolygon
80-
- point
81-
- polygon
82-
- name: Random
83-
- randomPosition
84-
- randomPoint
85-
- randomLineString
86-
- randomPolygon
87-
- name: Data
88-
- sample
89-
- name: Interpolation
90-
- interpolate
91-
- isobands
92-
- isolines
93-
- planepoint
94-
- tin
95-
- name: Joins
96-
- pointsWithinPolygon
97-
- tag
98-
- name: Grids
99-
- hexGrid
100-
- pointGrid
101-
- squareGrid
102-
- triangleGrid
103-
- name: Classification
104-
- nearestPoint
105-
- name: Aggregation
106-
- collect
107-
- clustersDbscan
108-
- clustersKmeans
109-
- name: Meta
110-
- coordAll
111-
- coordEach
112-
- coordReduce
113-
- featureEach
114-
- featureReduce
115-
- flattenEach
116-
- flattenReduce
117-
- getCoord
118-
- getCoords
119-
- getGeom
120-
- getType
121-
- geomEach
122-
- geomReduce
123-
- propEach
124-
- propReduce
125-
- segmentEach
126-
- segmentReduce
127-
- getCluster
128-
- clusterEach
129-
- clusterReduce
130-
- name: Assertions
131-
- collectionOf
132-
- containsNumber
133-
- geojsonType
134-
- featureOf
135-
- name: Booleans
136-
- booleanClockwise
137-
- booleanConcave
138-
- booleanContains
139-
- booleanCrosses
140-
- booleanDisjoint
141-
- booleanEqual
142-
- booleanIntersects
143-
- booleanOverlap
144-
- booleanParallel
145-
- booleanPointInPolygon
146-
- booleanPointOnLine
147-
- booleanTouches
148-
- booleanWithin
149-
- name: Unit Conversion
150-
- bearingToAzimuth
151-
- azimuthToBearing
152-
- convertArea
153-
- convertLength
154-
- degreesToRadians
155-
- lengthToRadians
156-
- lengthToDegrees
157-
- radiansToLength
158-
- radiansToDegrees
159-
- toMercator
160-
- toWgs84
2+
Measurement:
3+
- along
4+
- area
5+
- bbox
6+
- bboxPolygon
7+
- bearing
8+
- center
9+
- centerOfMass
10+
- centroid
11+
- destination
12+
- distance
13+
- envelope
14+
- length
15+
- midpoint
16+
- pointOnFeature
17+
- polygonTangents
18+
- pointToLineDistance
19+
- rhumbBearing
20+
- rhumbDestination
21+
- rhumbDistance
22+
- square
23+
- greatCircle
24+
Coordinate Mutation:
25+
- cleanCoords
26+
- flip
27+
- rewind
28+
- round
29+
- truncate
30+
Transformation:
31+
- bboxClip
32+
- bezierSpline
33+
- buffer
34+
- circle
35+
- clone
36+
- concave
37+
- convex
38+
- difference
39+
- dissolve
40+
- intersect
41+
- lineOffset
42+
- polygonSmooth
43+
- simplify
44+
- tesselate
45+
- transformRotate
46+
- transformTranslate
47+
- transformScale
48+
- union
49+
- voronoi
50+
Feature Conversion:
51+
- combine
52+
- explode
53+
- flatten
54+
- lineToPolygon
55+
- polygonize
56+
- polygonToLine
57+
Misc:
58+
- kinks
59+
- lineArc
60+
- lineChunk
61+
- lineIntersect
62+
- lineOverlap
63+
- lineSegment
64+
- lineSlice
65+
- lineSliceAlong
66+
- lineSplit
67+
- mask
68+
- nearestPointOnLine
69+
- sector
70+
- shortestPath
71+
- unkinkPolygon
72+
Helper:
73+
- featureCollection
74+
- feature
75+
- geometryCollection
76+
- lineString
77+
- multiLineString
78+
- multiPoint
79+
- multiPolygon
80+
- point
81+
- polygon
82+
Random:
83+
- randomPosition
84+
- randomPoint
85+
- randomLineString
86+
- randomPolygon
87+
Data:
88+
- sample
89+
Interpolation:
90+
- interpolate
91+
- isobands
92+
- isolines
93+
- planepoint
94+
- tin
95+
Joins:
96+
- pointsWithinPolygon
97+
- tag
98+
Grids:
99+
- hexGrid
100+
- pointGrid
101+
- squareGrid
102+
- triangleGrid
103+
Classification:
104+
- nearestPoint
105+
Aggregation:
106+
- collect
107+
- clustersDbscan
108+
- clustersKmeans
109+
Meta:
110+
- coordAll
111+
- coordEach
112+
- coordReduce
113+
- featureEach
114+
- featureReduce
115+
- flattenEach
116+
- flattenReduce
117+
- getCoord
118+
- getCoords
119+
- getGeom
120+
- getType
121+
- geomEach
122+
- geomReduce
123+
- propEach
124+
- propReduce
125+
- segmentEach
126+
- segmentReduce
127+
- getCluster
128+
- clusterEach
129+
- clusterReduce
130+
Assertions:
131+
- collectionOf
132+
- containsNumber
133+
- geojsonType
134+
- featureOf
135+
Booleans:
136+
- booleanClockwise
137+
- booleanConcave
138+
- booleanContains
139+
- booleanCrosses
140+
- booleanDisjoint
141+
- booleanEqual
142+
- booleanIntersects
143+
- booleanOverlap
144+
- booleanParallel
145+
- booleanPointInPolygon
146+
- booleanPointOnLine
147+
- booleanTouches
148+
- booleanWithin
149+
Unit Conversion:
150+
- bearingToAzimuth
151+
- azimuthToBearing
152+
- convertArea
153+
- convertLength
154+
- degreesToRadians
155+
- lengthToRadians
156+
- lengthToDegrees
157+
- radiansToLength
158+
- radiansToDegrees
159+
- toMercator
160+
- toWgs84
161161
paths:
162162
GeoJSON: "https://tools.ietf.org/html/rfc7946#section-3"
163+
GeoJsonProperties: "https://tools.ietf.org/html/rfc7946#section-3.2"
163164
GeometryCollection: "https://tools.ietf.org/html/rfc7946#section-3.1.8"
164165
Point: "https://tools.ietf.org/html/rfc7946#section-3.1.2"
165166
Points: "https://tools.ietf.org/html/rfc7946#section-3.1.2"

packages/turf-along/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ Takes a [LineString][1] and returns a [Point][2] at a specified distance along t
88

99
### Parameters
1010

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

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

1717
### Examples
1818

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

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

41-
[6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String
42-
4341
<!-- 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. -->
4442

4543
---

packages/turf-along/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ import { getGeom } from "@turf/invariant";
88
/**
99
* Takes a {@link LineString} and returns a {@link Point} at a specified distance along the line.
1010
*
11-
* @name along
12-
* @param {Feature<LineString>} line input line
11+
* @function
12+
* @param {Feature<LineString>|LineString} line input line
1313
* @param {number} distance distance along the line
1414
* @param {Object} [options] Optional parameters
15-
* @param {string} [options.units="kilometers"] can be degrees, radians, miles, or kilometers
15+
* @param {Units} [options.units="kilometers"] can be degrees, radians, miles, or kilometers
1616
* @returns {Feature<Point>} Point `distance` `units` along the line
1717
* @example
1818
* var line = turf.lineString([[-83, 30], [-84, 36], [-78, 41]]);

packages/turf-angle/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { rhumbBearing } from "@turf/rhumb-bearing";
66
* Finds the angle formed by two adjacent segments defined by 3 points. The result will be the (positive clockwise)
77
* angle with origin on the `startPoint-midPoint` segment, or its explementary angle if required.
88
*
9-
* @name angle
9+
* @function
1010
* @param {Coord} startPoint Start Point Coordinates
1111
* @param {Coord} midPoint Mid Point Coordinates
1212
* @param {Coord} endPoint End Point Coordinates

packages/turf-area/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { geomReduce } from "@turf/meta";
55
/**
66
* Calculates the geodesic area in square meters of one or more polygons.
77
*
8-
* @name area
8+
* @function
99
* @param {GeoJSON} geojson input polygon(s) as {@link Geometry}, {@link Feature}, or {@link FeatureCollection}
1010
* @returns {number} area in square meters
1111
* @example

packages/turf-bbox-clip/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import { lineclip, polygonclip } from "./lib/lineclip.js";
2222
* [lineclip](https://github.com/mapbox/lineclip).
2323
* May result in degenerate edges when clipping Polygons.
2424
*
25-
* @name bboxClip
25+
* @function
2626
* @param {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} feature feature to clip to the bbox
2727
* @param {BBox} bbox extent in [minX, minY, maxX, maxY] order
2828
* @returns {Feature<LineString|MultiLineString|Polygon|MultiPolygon>} clipped Feature

0 commit comments

Comments
 (0)