centroid
The mean of a geometry's vertices, as a map position. This is a plain average of the positions (a ring's repeated closing position counts once), so a polygon with many vertices along one side leans towards that side. It is not the centre of mass, and for a concave shape it may fall outside it.
This is a function exported by @mapcairn/core, checked against version 0.2.0.
Signature
import { centroid } from "@mapcairn/core";
function centroid(input: GeometryInput): LatLng;
Parameters
input(GeometryInput)
Returns
LatLng
Throws
GeometryErrorof kindinvalidfor a malformed geometry,emptywhen it has no positions.