center
Description
Takes a Feature or FeatureCollection and returns the absolute center point of all features.
Parameters
Name | Type | Description |
---|---|---|
geojson | GeoJSON | GeoJSON to be centered |
options? | Object | Optional parameters (default {}) |
options.properties? | Object | Translate GeoJSON Properties to Point (default {}) |
options.bbox? | Object | Translate GeoJSON BBox to Point (default {}) |
options.id? | Object | Translate GeoJSON Id to Point (default {}) |
Returns
Examples
var features = turf.points([
[-97.522259, 35.4691],
[-97.502754, 35.463455],
[-97.508269, 35.463245],
]);
var center = turf.center(features);
Installation
$ npm install @turf/center
import { center } from "@turf/center";
const result = center(...);
$ npm install @turf/turf
import * as turf from "@turf/turf";
const result = turf.center(...);