Geo
The /geo endpoint calculates the distance and bearing between two GPS coordinates using the Haversine formula.
How it works?
The Haversine formula computes the great-circle distance between two points on a sphere — the shortest path over the Earth's surface, ignoring elevation. Bearing is the initial compass heading from point A to point B, expressed in degrees (0° = North) and as a cardinal direction.
curl -X GET \ "https://api.moxon.dev/v4/geo"Send the request to see the response here.
lat1numberrequiredLatitude of point A (-90/+90)
lon1numberrequiredLongitude of point A (-180/+180)
lat2numberrequiredLatitude of point B (-90/+90)
lon2numberrequiredLongitude of point B (-180/+180)
distance.kmnumberDistance in kilometers
distance.milesnumberDistance in miles
distance.nauticalMilesnumberDistance in nautical miles
bearing.degreesnumberBearing in degrees (0–360)
bearing.cardinalstringCardinal direction (N, NNE, NE, ENE, E, etc.)
from.latnumberParsed latitude of point A
from.lonnumberParsed longitude of point A
to.latnumberParsed latitude of point B
to.lonnumberParsed longitude of point B
If parameters are missing or invalid, the API will return an error:
- 400
lat1 must be a numberA coordinate is not a valid number - 400
lat1 must be between -90 and 90Latitude is out of range - 400
lon1 must be between -180 and 180Longitude is out of range
Last updated on May 12, 2026