center
描述
¥Description
Takes a 特性 or FeatureCollection and returns the absolute center point of all features.
¥Takes a Feature or FeatureCollection and returns the absolute center point of all features.
参数
¥Parameters
名称 | 类型 | 描述 |
---|---|---|
geojson | GeoJSON | 待居中的 GeoJSON |
options? | 对象 | 可选参数(默认 ) |
options.properties? | 对象 | Translate GeoJSON Properties to Point (default ) |
options.bbox? | 对象 | Translate GeoJSON BBox to Point (default ) |
options.id? | 对象 | Translate GeoJSON Id to Point (default ) |
返回
¥Returns
特性<点> a Point feature at the absolute center point of all input features
¥Feature<Point> a Point feature at the absolute center point of all input features
示例
¥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(...);