Centroid calculator

Draw a shape or paste a list of points and get its centre three ways: the centroid of the area, the mean of the points, and the middle of the bounding box.

How to use it

  1. Draw a shape on the map, place points, paste coordinates one per line, or open a GeoJSON, KML or GPX file.
  2. Read the three centres: the centroid of the area, the mean of the points and the centre of the bounding box.
  3. Click a value to copy it. The pins on the map show the three centres.

5 practical uses

  1. Find the centre of a plot, a field or a lake for a marker or a label.
  2. Find the middle of a set of customer locations for a depot or a shop.
  3. Place a map label at the centre of an area.
  4. Find the centre of a search area or a survey grid.
  5. Check the centroid a GIS tool reports.

The maths behind it

The centroid of a polygon is C = (1/6A) Σ (pᵢ + pᵢ₊₁)(xᵢ yᵢ₊₁ − xᵢ₊₁ yᵢ) over its edges, where A is its signed area; for several polygons the centroids are weighted by area. The mean of a set of points is found by converting each to a unit vector in three dimensions, averaging, and converting back, which is correct across the date line. The bounding-box centre is the midpoint of the extreme coordinates.

Three centres

The centroid of a crescent or a ring can fall outside the shape; that is correct. For several shapes the centroid is weighted by area. For a meeting point between people, see the midpoint calculator.

Questions and answers

Which centre should I use?

The centroid for a shape, where a cut-out would balance. The mean of the points for a set of locations. The bounding-box centre to centre a map view.

Why is the centroid outside the shape?

For a crescent, a ring or an L shape the centre of mass can fall outside the outline. That is correct.

Does it work across the date line?

Yes. The mean is computed in three dimensions on the sphere, so points on both sides of 180 degrees average correctly.

Embed this tool on your website

Paste this code where the tool should appear. It shows the tool alone, without this page's text, and links back here. It is free to use; the map data credit stays on the map.

<iframe src="https://waymorphic.com/tools/centroid-calculator?embed=1" width="100%" height="760" style="border:0;border-radius:12px;max-width:100%" loading="lazy" allow="geolocation; fullscreen; clipboard-write" title="Centroid calculator – Waymorphic Map"></iframe>

Change height to suit your page. To open the tool with a place already set, add the settings from this page's address bar (the part after #) to the end of the src. The embedded tool asks the visitor's browser for their location only when they press the button, and the allow attribute lets that work inside the frame.