# 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

```ts
import { centroid } from "@mapcairn/core";
 
function centroid(input: GeometryInput): LatLng;
```

## Parameters

- `input` (`GeometryInput`)

## Returns

`LatLng`

## Throws

- `GeometryError` of kind `invalid` for a malformed geometry, `empty` when it
   has no positions.

## See also

- [`GeometryInput`](https://docs.mapcairn.com/api/core/GeometryInput.md)
- [`LatLng`](https://docs.mapcairn.com/api/core/LatLng.md)

Source: [packages/core/src/geometry/queries.ts:66](https://github.com/MapCairn/mapcairn/blob/main/packages/core/src/geometry/queries.ts#L66)
