Calculate the geometric center point of any polygon using coordinate arrays. Access via MCP in Cursor or Windsurf, or hit GET /v1/geo/centroid directly. Pass polygon vertices as lat/lng pairs, get back precise centroid coordinates. Uses standard centroid algorithm for irregular polygons — essential for mapping applications and spatial analysis.
curl "https://tinyfn.io/v1/geo/centroid" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/geo/centroid', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/geo/centroid',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's geolocation tools:
{
"mcpServers": {
"tinyfn-geo": {
"url": "https://tinyfn.io/mcp/geo",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Send polygon vertices as an array of [lat, lng] coordinate pairs to the centroid endpoint. The tool returns the geometric center point using the standard polygon centroid formula.
Accepts arrays of latitude/longitude pairs in decimal degrees format. Vertices should be ordered (clockwise or counterclockwise) to define the polygon boundary properly.
Yes, the centroid tool handles any polygon shape through MCP integration. Works with irregular polygons, complex boundaries, and multi-sided shapes using geometric centroid calculation.
The tool calculates geometric centroids for simple polygons. Self-intersecting or overlapping polygons may produce unexpected results since the standard algorithm assumes non-intersecting boundaries.
Centroid is the geometric center based on polygon shape, while geographic center considers Earth's curvature. This tool provides geometric centroid using Cartesian coordinates.
Get your free API key and start using Polygon Centroid in seconds.
Get Free API Key