GET /v1/haversineCalculate distance between coordinates
Agent Tools lf-agent-tools
Works out how far apart two places on Earth are, as the crow flies. Calculates great-circle distance between two lat/lon pairs using the Haversine formula. Returns km and miles.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
lat1 | number | Yes | Latitude of point 1 |
lon1 | number | Yes | Longitude of point 1 |
lat2 | number | Yes | Latitude of point 2 |
lon2 | number | Yes | Longitude of point 2 |
Response Schema
distanceKm (number): Distance in kilometers
distanceMi (number): Distance in miles
from (string): Origin coordinates
to (string): Destination coordinates
cURL Example
curl 'https://lf-agent-tools.laminarforge.dev/v1/haversine?lat1=40.71&lon1=-74.01&lat2=51.51&lon2=-0.13' -H 'Authorization: Bearer lf_YourApiKey'
Python Example
import requests
url = 'https://lf-agent-tools.laminarforge.dev/v1/haversine'
headers = {'Authorization': 'Bearer lf_YourApiKey'}
params = {'lat1': 40.71, 'lon1': -74.01, 'lat2': 51.51, 'lon2': -0.13}
response = requests.get(url, headers=headers, params=params)
print(response.json())