Distance between coordinates: km, miles, bearing and midpoint
Great-circle distance between two latitude/longitude points (haversine on the mean earth radius) in kilometres, miles and nautical miles, plus the initial compass bearing and the midpoint. Accurate to about 0.5% against the ellipsoid. Use for delivery radius, travel and proximity checks, or sorting places by distance; for coordinates of a place name use geocode first.
Inputs
| Name | Type | Description |
|---|---|---|
lat1 (required) | number | Latitude of the first point (-90 to 90) |
lon1 (required) | number | Longitude of the first point (-180 to 180) |
lat2 (required) | number | Latitude of the second point |
lon2 (required) | number | Longitude of the second point |
Request
Over HTTP, with a card key from /credits:
curl -H "Authorization: Bearer adt_…" "https://agent-data-tools.revmesh2074.workers.dev/geo/distance?lat1=59.3293&lon1=18.0686&lat2=51.5072&lon2=-0.1276"
Or one of your 25 free calls, no key:
curl "https://agent-data-tools.revmesh2074.workers.dev/geo/distance?lat1=59.3293&lon1=18.0686&lat2=51.5072&lon2=-0.1276&trial=1"
Without a key, the same URL answers 402 Payment Required with x402 and MPP terms, so an agent with a wallet pays per call in USDC (Base, Polygon, Arbitrum or Solana over x402; Base or Tempo over MPP) and retries.
Example result
{
"km": 1432.79,
"miles": 890.29,
"nauticalMiles": 773.64,
"bearing": 240.6,
"compass": "WSW",
"midpoint": {
"lat": 55.7531,
"lon": 8.0606
}
}
From an AI agent (MCP)
Add the MCP server to Claude, Cursor or any MCP client. This tool is geo_distance, and the first 25 successful calls are free:
https://agent-data-tools.revmesh2074.workers.dev/mcp