Skip to content

Commit

Permalink
Fixed position of documentation.js '//addToMap' tag (Turfjs#857)
Browse files Browse the repository at this point in the history
* fixed position of documentation.js '//addToMap' tag

* Update truncate example

* Fix major `@example` errors

* soft "revert" of addToMap changes

* Update 25x Readmes
  • Loading branch information
stebogit authored and DenisCarriere committed Jul 24, 2017
1 parent 2af43f6 commit 8b8d912
Show file tree
Hide file tree
Showing 49 changed files with 231 additions and 678 deletions.
25 changes: 8 additions & 17 deletions packages/turf-bezier/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,14 @@ The bezier spline implementation is by [Leszek Rybicki](http://leszek.rybicki.cc
**Examples**

```javascript
var line = {
"type": "Feature",
"properties": {
"stroke": "#f00"
},
"geometry": {
"type": "LineString",
"coordinates": [
[-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 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.bezier(line);

Expand Down
25 changes: 8 additions & 17 deletions packages/turf-bezier/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,14 @@ var Spline = require('./spline.js');
* @param {number} [sharpness=0.85] a measure of how curvy the path should be between splines
* @returns {Feature<LineString>} curved line
* @example
* var line = {
* "type": "Feature",
* "properties": {
* "stroke": "#f00"
* },
* "geometry": {
* "type": "LineString",
* "coordinates": [
* [-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 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.bezier(line);
*
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-boolean-clockwise/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Takes a ring and return true or false whether or not the ring is clockwise or co
**Examples**

```javascript
var clockwiseRing = [[0,0],[1,1],[1,0],[0,0]]
var counterClockwiseRing = [[0,0],[1,0],[1,1],[0,0]]
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
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-boolean-clockwise/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ var getCoords = invariant.getCoords;
* @param {Geometry|Feature<LineString>|Array<Array<number>>} line to be evaluated
* @returns {Boolean} true/false
* @example
* var clockwiseRing = [[0,0],[1,1],[1,0],[0,0]]
* var counterClockwiseRing = [[0,0],[1,0],[1,1],[0,0]]
* 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
Expand Down
19 changes: 3 additions & 16 deletions packages/turf-boolean-contains/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,9 @@ Boolean-contains returns the exact opposite result of the `@turf/boolean-within`
**Examples**

```javascript
const point = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [1, 2]
}
}
const line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]]
}
}
const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
const point = turf.point([1, 2]);

turf.booleanContains(line, point);
//=true
```
Expand Down
19 changes: 3 additions & 16 deletions packages/turf-boolean-contains/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,9 @@ var getGeomType = invariant.getGeomType;
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {Boolean} true/false
* @example
* const point = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [1, 2]
* }
* }
* const line = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]]
* }
* }
* const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
* const point = turf.point([1, 2]);
*
* turf.booleanContains(line, point);
* //=true
*/
Expand Down
8 changes: 6 additions & 2 deletions packages/turf-boolean-crosses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,14 @@ Boolean-Crosses returns t (TRUE) for only multipoint/polygon, multipoint/linestr
**Examples**

```javascript
var cross = turf.booleanCrosses(feature1, feature2);
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
```

Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
Expand Down
8 changes: 6 additions & 2 deletions packages/turf-boolean-crosses/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ var getGeomType = invariant.getGeomType;
* @name booleanCrosses
* @param {Geometry|Feature<any>} feature1 GeoJSON Feature or Geometry
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {Boolean} true/false
* @returns {boolean} true/false
* @example
* var cross = turf.booleanCrosses(feature1, feature2);
* 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
*/

module.exports = function (feature1, feature2) {
Expand Down
19 changes: 3 additions & 16 deletions packages/turf-boolean-disjoint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,9 @@ Boolean-disjoint returns (TRUE) if the intersection of the two geometries is an
**Examples**

```javascript
const point = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [2, 2]
}
}
const line = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "LineString",
"coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]]
}
}
const point = turf.point([2, 2]);
const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);

turf.booleanDisjoint(line, point);
//=true
```
Expand Down
19 changes: 3 additions & 16 deletions packages/turf-boolean-disjoint/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,9 @@ var polyToLinestring = require('@turf/polygon-to-linestring');
* @param {Geometry|Feature<any>} feature2 GeoJSON Feature or Geometry
* @returns {Boolean} true/false
* @example
* const point = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [2, 2]
* }
* }
* const line = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "LineString",
* "coordinates": [[1, 1], [1, 2], [1, 3], [1, 4]]
* }
* }
* const point = turf.point([2, 2]);
* const line = turf.lineString([[1, 1], [1, 2], [1, 3], [1, 4]]);
*
* turf.booleanDisjoint(line, point);
* //=true
*/
Expand Down
4 changes: 2 additions & 2 deletions packages/turf-boolean-point-on-line/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Returns true if a point is on a line. Accepts a optional parameter to ignore the

- `point` **([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>)** GeoJSON Feature or Geometry
- `linestring` **([Geometry](http://geojson.org/geojson-spec.html#geometry) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)&lt;[LineString](http://geojson.org/geojson-spec.html#linestring)>)** GeoJSON Feature or Geometry
- `ignoreEndVertices` **\[[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether to ignore the start and end vertices. (optional, default `false`)
- `ignoreEndVertices` **\[[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)]** whether to ignore the start and end vertices. (optional, default `false`)

**Examples**

Expand All @@ -19,7 +19,7 @@ var isPointOnLine = turf.booleanPointOnLine(pt, line);
//=true
```

Returns **[Boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false
Returns **[boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean)** true/false

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
Expand Down
32 changes: 5 additions & 27 deletions packages/turf-center/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,11 @@ Takes a [Feature](http://geojson.org/geojson-spec.html#feature-objects) or [Feat
**Examples**

```javascript
var features = {
"type": "FeatureCollection",
"features": [
{
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [-97.522259, 35.4691]
}
}, {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [-97.502754, 35.463455]
}
}, {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [-97.508269, 35.463245]
}
}
]
};
var features = turf.featureCollection([
turf.point([-97.522259, 35.4691]),
turf.point([-97.502754, 35.463455]),
turf.point([-97.508269, 35.463245])
]);

var center = turf.center(features);

Expand Down
32 changes: 5 additions & 27 deletions packages/turf-center/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,11 @@ var point = require('@turf/helpers').point;
* @param {Object} [properties] an Object that is used as the {@link Feature}'s properties
* @returns {Feature<Point>} a Point feature at the absolute center point of all input features
* @example
* var features = {
* "type": "FeatureCollection",
* "features": [
* {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-97.522259, 35.4691]
* }
* }, {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-97.502754, 35.463455]
* }
* }, {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-97.508269, 35.463245]
* }
* }
* ]
* };
* var features = turf.featureCollection([
* turf.point([-97.522259, 35.4691]),
* turf.point([-97.502754, 35.463455]),
* turf.point([-97.508269, 35.463245])
* ]);
*
* var center = turf.center(features);
*
Expand Down
12 changes: 6 additions & 6 deletions packages/turf-clusters-dbscan/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Takes a set of [points](http://geojson.org/geojson-spec.html#point) and partitio

**Parameters**

- `points` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array)&lt;[Feature](http://geojson.org/geojson-spec.html#feature-objects)>)** to be clustered
- `points` **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** to be clustered
- `maxDistance` **[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)** Maximum Distance between any point of the cluster to generate the clusters (kilometers only)
- `units` **\[[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)]** in which `maxDistance` is expressed, can be degrees, radians, miles, or kilometers (optional, default `kilometers`)
- `minPoints` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number)]** Minimum number of points to generate a single cluster, points will be excluded if the
cluster does not meet the minimum amounts of points. (optional, default `3`)
- `minPoints` **\[[number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/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'. (optional, default `3`)

**Examples**

Expand All @@ -23,11 +23,11 @@ var distance = 100;
var clustered = turf.clustersDbscan(points, distance);

//addToMap
var addToMap = featureCollection(clustered.points);
var addToMap = clustered;
```

Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** each Point has two extra properties; `cluster` property with the cluster number it belongs &
`dbscan` which is defines the which type of point it has been flagged as ('core'|'edge'|'noise').
Returns **[FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects)&lt;[Point](http://geojson.org/geojson-spec.html#point)>** 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')

<!-- This file is automatically generated. Please don't edit it directly:
if you find an error, edit the source file (likely index.js), and re-run
Expand Down
9 changes: 1 addition & 8 deletions packages/turf-destination/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ Takes a [Point](http://geojson.org/geojson-spec.html#point) and calculates the l
**Examples**

```javascript
var point = {
"type": "Feature",
"properties": {},
"geometry": {
"type": "Point",
"coordinates": [-75.343, 39.984]
}
};
var point = turf.point([-75.343, 39.984]);
var distance = 50;
var bearing = 90;
var units = 'miles';
Expand Down
9 changes: 1 addition & 8 deletions packages/turf-destination/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,7 @@ var distanceToRadians = helpers.distanceToRadians;
* @param {string} [units=kilometers] miles, kilometers, degrees, or radians
* @returns {Feature<Point>} destination point
* @example
* var point = {
* "type": "Feature",
* "properties": {},
* "geometry": {
* "type": "Point",
* "coordinates": [-75.343, 39.984]
* }
* };
* var point = turf.point([-75.343, 39.984]);
* var distance = 50;
* var bearing = 90;
* var units = 'miles';
Expand Down
Loading

0 comments on commit 8b8d912

Please sign in to comment.