# centroid

Takes one or more features and calculates the centroid using the mean of all vertices. This lessens the effect of small islands and artifacts when calculating the centroid of a set of polygons.


参数 类型 描述
geojson GeoJSON GeoJSON to be centered
properties Object an Object that is used as the Feature 's properties


Feature <Point> - the centroid of the input features


var polygon = turf.polygon([[[-81, 41], [-88, 36], [-84, 31], [-80, 33], [-77, 39], [-81, 41]]]);

var centroid = turf.centroid(polygon);
Last Updated: 1/19/2021, 10:59:20 AM