Geographic Center
Find the geographic centroid of a set of coordinates
POST
1 credit
/v1/geo/center
curl -X POST "https://geo.toolkitapi.io/v1/geo/center" \
-H "Content-Type: application/json" \
-d '{
"points": [
{"lat": 40.7128, "lon": -74.006},
{"lat": 34.0522, "lon": -118.2437},
{"lat": 41.8781, "lon": -87.6298}
]
}'
import httpx
resp = httpx.post(
"https://geo.toolkitapi.io/v1/geo/center",
json={
"points": [
{"lat": 40.7128, "lon": -74.006},
{"lat": 34.0522, "lon": -118.2437},
{"lat": 41.8781, "lon": -87.6298}
]
},
)
print(resp.json())
const resp = await fetch("https://geo.toolkitapi.io/v1/geo/center", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
"points": [
{"lat": 40.7128, "lon": -74.006},
{"lat": 34.0522, "lon": -118.2437},
{"lat": 41.8781, "lon": -87.6298}
]
}),
});
const data = await resp.json();
console.log(data);
# See curl example
Response
200 OK
{
"center": {
"lat": 39.0283,
"lon": -93.5765
},
"point_count": 3
}
Try It Live
Live Demo
Response
Description
Find the geographic centroid of a set of coordinates
How to Use
1
1. Provide an array of at least two coordinate points in the `points` field.
2
2. Send a POST request and read the `center` object for the resulting latitude and longitude.
3
3. Use `point_count` to confirm all input points were processed.
About This Tool
Use Geographic Center to calculate the centroid of two or more latitude/longitude coordinates. The algorithm converts points to Cartesian coordinates, averages them, and converts back, producing an accurate geographic center even for points spread across large distances.
This is useful for determining the optimal meeting point, centering a map view, or finding the midpoint of a delivery zone.
Why Use This Tool
- Map centering — Automatically center a map view on a set of markers
- Meeting point — Find the geographic midpoint between multiple locations
- Delivery zones — Calculate the center of a service area
- Cluster analysis — Determine centroids for spatial clustering algorithms
Frequently Asked Questions
Is this a weighted or unweighted centroid?
This is an unweighted centroid — all points contribute equally. If you need weighted averaging, compute it client-side.
Does this work for points on opposite sides of the globe?
Yes. The Cartesian averaging method handles antipodal points correctly, though the result may be ambiguous when points are symmetrically distributed.
What is the maximum number of points?
There is no enforced limit, but performance is best with arrays under a few thousand points.
Start using Geographic Center now
Get your free API key and make your first request in under a minute.