Geometry
Polygon area/centroid API
Area, perimeter and centroid of an arbitrary simple polygon via the shoelace formula, with winding direction and convexity. Answers 'what is the area and centroid of this polygon?', 'is it convex?'.
Price$0.02per request
MethodPOST
Route/v1/geometry/polygon-metrics
StatusLive
MIME typeapplication/json
Rate limit120/minute
Cache0s public
polygonareacentroidperimetershoelaceconvexwinding2d
API URL
Integration docshttps://x402.hexl.dev/v1/geometry/polygon-metricsExample request
{
"vertices": [
[
0,
0
],
[
4,
0
],
[
4,
3
],
[
0,
3
]
]
}Example response
{
"area": 12,
"perimeter": 14,
"centroid": [
2,
1.5
],
"winding": "counter-clockwise",
"convex": true,
"vertexCount": 4
}Input schema
{
"type": "object",
"required": [
"vertices"
],
"properties": {
"vertices": {
"type": "array",
"items": {
"type": "array",
"items": {
"type": "number"
}
},
"examples": [
[
[
0,
0
],
[
4,
0
],
[
4,
3
],
[
0,
3
]
]
]
}
}
}Output schema
{
"type": "object",
"additionalProperties": true
}