@turf/center
Advanced tools
Comparing version 4.3.0 to 4.4.0
@@ -10,4 +10,4 @@ /// <reference types="geojson" /> | ||
*/ | ||
declare function center(features: Feature | Features): Point; | ||
declare function center(features: Feature | Features, properties?: any): Point; | ||
declare namespace center { } | ||
export = center; |
@@ -8,3 +8,4 @@ var bbox = require('@turf/bbox'); | ||
* @name center | ||
* @param {FeatureCollection|Feature<any>} layer input features | ||
* @param {GeoJSON} geojson GeoJSON to be centered | ||
* @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 | ||
@@ -47,7 +48,7 @@ * @example | ||
*/ | ||
module.exports = function (layer) { | ||
var ext = bbox(layer); | ||
module.exports = function (geojson, properties) { | ||
var ext = bbox(geojson); | ||
var x = (ext[0] + ext[2]) / 2; | ||
var y = (ext[1] + ext[3]) / 2; | ||
return point([x, y]); | ||
return point([x, y], properties); | ||
}; |
{ | ||
"name": "@turf/center", | ||
"version": "4.3.0", | ||
"version": "4.4.0", | ||
"description": "turf center module", | ||
@@ -34,9 +34,13 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@turf/meta": "^4.4.0", | ||
"benchmark": "^2.1.4", | ||
"tape": "^4.6.3" | ||
"glob": "^7.1.2", | ||
"load-json-file": "^2.0.0", | ||
"tape": "^4.6.3", | ||
"write-json-file": "^2.2.0" | ||
}, | ||
"dependencies": { | ||
"@turf/bbox": "^4.3.0", | ||
"@turf/helpers": "^4.3.0" | ||
"@turf/bbox": "^4.4.0", | ||
"@turf/helpers": "^4.4.0" | ||
} | ||
} |
@@ -9,3 +9,4 @@ # @turf/center | ||
- `layer` **([FeatureCollection](http://geojson.org/geojson-spec.html#feature-collection-objects) \| [Feature](http://geojson.org/geojson-spec.html#feature-objects)<any>)** input features | ||
- `geojson` **[GeoJSON](http://geojson.org/geojson-spec.html#geojson-objects)** GeoJSON to be centered | ||
- `properties` **\[[Object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object)]** an Object that is used as the [Feature](http://geojson.org/geojson-spec.html#feature-objects)'s properties | ||
@@ -12,0 +13,0 @@ **Examples** |
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
5963
61
77
6
Updated@turf/bbox@^4.4.0
Updated@turf/helpers@^4.4.0