Calculate the total length of a polyline by summing distances between consecutive coordinate points. Use via MCP in Cursor or Windsurf, or call GET /v1/geo/polyline-length with coordinate arrays. Returns precise measurements in meters using the Haversine formula. Perfect for route distance calculations in mapping applications.
curl "https://tinyfn.io/v1/geo/polyline-length" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/geo/polyline-length', {
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/polyline-length',
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"
}
}
}
}
Call the polyline-length tool with an array of [latitude, longitude] coordinate pairs. The MCP tool returns total distance in meters between all consecutive points.
Accepts arrays of coordinate pairs in [latitude, longitude] format, where latitude is -90 to 90 and longitude is -180 to 180 decimal degrees.
Yes, it uses the Haversine formula to calculate great-circle distances between points, accounting for Earth's spherical shape for accurate results.
Yes, the tool handles polylines with any number of coordinate points, calculating cumulative distance by summing all segment lengths between consecutive waypoints.
Polyline length sums distances between all consecutive coordinate pairs, while straight-line distance only measures between start and end points.
Get your free API key and start using Polyline Length in seconds.
Get Free API Key