turf-centroid
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -10,3 +10,4 @@ var each = require('turf-meta').coordEach; | ||
* @module turf/centroid | ||
* @param {FeatureCollection} fc a {@link Feature} or FeatureCollection of any type | ||
* @category measurement | ||
* @param {GeoJSON} features a {@link Feature} or FeatureCollection of any type | ||
* @return {Point} a Point feature at the centroid of the input feature(s) | ||
@@ -13,0 +14,0 @@ * @example |
{ | ||
"name": "turf-centroid", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"description": "turf centroid module", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -8,3 +8,3 @@ # turf-centroid | ||
### `turf.centroid(fc)` | ||
### `turf.centroid(features)` | ||
@@ -18,5 +18,5 @@ Takes a Feature or FeatureCollection of any type and calculates the centroid using the arithmetic mean of all vertices. | ||
| parameter | type | description | | ||
| --------- | ----------------- | ------------------------------------------ | | ||
| `fc` | FeatureCollection | a Feature or FeatureCollection of any type | | ||
| parameter | type | description | | ||
| ---------- | ------- | ------------------------------------------ | | ||
| `features` | GeoJSON | a Feature or FeatureCollection of any type | | ||
@@ -27,13 +27,23 @@ | ||
```js | ||
var poly = turf.polygon([[ | ||
[105.818939,21.004714], | ||
[105.818939,21.061754], | ||
[105.890007,21.061754], | ||
[105.890007,21.004714], | ||
[105.818939,21.004714] | ||
]]); | ||
var poly = { | ||
"type": "Feature", | ||
"properties": {}, | ||
"geometry": { | ||
"type": "Polygon", | ||
"coordinates": [[ | ||
[105.818939,21.004714], | ||
[105.818939,21.061754], | ||
[105.890007,21.061754], | ||
[105.890007,21.004714], | ||
[105.818939,21.004714] | ||
]] | ||
} | ||
}; | ||
var centroidPt = turf.centroid(poly); | ||
var result = turf.featurecollection([poly, centroidPt]); | ||
var result = { | ||
"type": "FeatureCollection", | ||
"features": [poly, centroidPt] | ||
}; | ||
@@ -40,0 +50,0 @@ //=result |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
110065
77
64