API Almanac

Great-circle distance, bearings, midpoint and bounding box between two coordinates

GET/v1/geo/distance

GET/v1/geo/distance

Great-circle distance, bearings, midpoint and bounding box between two coordinates

Give lat2/lon2 for a second point, or bearing and distance_km to project from the first point instead. radius_km adds a bounding box around the first point, handy for "within 25 km" searches.

PARAMETERS
lat1query · numberREQUIRED
First point latitude
e.g. 40.7128
lon1query · numberREQUIRED
First point longitude
e.g. -74.006
lat2query · number
Second point latitude
e.g. 51.5074
lon2query · number
Second point longitude
e.g. -0.1278
bearingquery · number
Projection: initial bearing in degrees
e.g. 0
distance_kmquery · number
Projection: distance to travel
e.g. 0
radius_kmquery · number
Bounding box radius around the first point
e.g. 0
In the full reference
REQUEST
curl "https://api.apialmanac.com/v1/geo/distance?lat1=40.7128&lon1=-74.006" \
  -H "X-API-Key: YOUR_KEY"
RESPONSE
200OK
{
  "from": {
    "lat": 40.7128,
    "lon": -74.006
  },
  "to": {
    "lat": 51.5074,
    "lon": -0.1278
  },
  "distance": {
    "km": 5570.2,
    "mi": 3461.2,
    "nmi": 3007.7,
    "m": 5570222
  },
  "initial_bearing": 51.2,
  "final_bearing": 108.3,
  "compass": "NE",
  "midpoint": {
    "lat": 52.3,
    "lon": -41.7
  },
  "bounding_box": {
    "south": 40.7128,
    "north": 51.5074,
    "west": -74.006,
    "east": -0.1278
  },
  "note": "great-circle on a sphere of radius 6371.0088 km"
}
Try it — sign in first
Runs on a sandbox key: 200 requests a month. Your real key is for production.