# centerOfMass

Takes any Feature or a FeatureCollection and returns its center of mass using this formula: Centroid of Polygon.
取任意FeatureFeatureCollection,并使用以下公式返回其质心:Polygon质心。

参数

参数 类型 描述
geojson GeoJSON GeoJSON to be centered
properties Object 一个用作Feature属性的对象

返回

Feature <Point> - 质心

示例

// 注意:polygon首尾坐标要一致
var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);

var center = turf.centerOfMass(polygon);
Last Updated: 6/21/2023, 11:40:17 PM