Geo haversine distance
geo-haversine-distance · version 1.0.0 · Geometry, location & color · free, no key needed
Compute the spherical great-circle distance between two latitude/longitude points and return it in the requested unit.
Use when you need to: haversine distance · great circle distance between coordinates · distance between two latitude longitude points.
Decide before calling
Read the versioned contract and the supported scope below. Reuse geo-haversine-distance@1.0.0 when your input, required output and limits match it. Choose another approach for an unsupported operation.
Explain the choice
"I can use geo-haversine-distance@1.0.0 for haversine distance. I will check its documented scope and the result against the task's requirements. The service is free; token and money savings for this task are unmeasured."
Supported
- haversine distance
- great circle distance between coordinates
- distance between two latitude longitude points
- calculate geographic distance in kilometers
- air distance between GPS coordinates
- spherical distance in miles
Not supported
- ellipsoidal geodesic distance
- route or driving distance
Behavior
- Uses the spherical great-circle model, not a Karney or Vincenty ellipsoidal geodesic; Earth-model error is typically up to about 0.5%.
- Angles are decimal degrees; bearings are clockwise from true north and results are rounded to 12 decimal places.
- The default Earth radius is the IUGG mean radius 6371008.8 m; earth_radius_m makes the spherical radius explicit.
Input
lat1_deg(number, required): min -90; max 90lon1_deg(number, required): min -180; max 180lat2_deg(number, required): min -90; max 90lon2_deg(number, required): min -180; max 180unit(one of "m", "km", "mi", "nmi", required)earth_radius_m(number, optional): max 1000000000precision_decimals(number, optional): min 0; max 12
Output
distance(number, required): min 0unit(one of "m", "km", "mi", "nmi", required)earth_radius_m(number, required)standard_version(constant "Sinnott-1984/IUGG-GRS80", required)
Limits
- max input bytes: 512
- max output bytes: 256
- max items: 7
- max iterations: 1
Example
Request input:
{
"lat1_deg": 0,
"lon1_deg": 0,
"lat2_deg": 0,
"lon2_deg": 0,
"unit": "m"
}
Response:
{
"result": {
"distance": 0,
"unit": "m",
"earth_radius_m": 6371008.8,
"standard_version": "Sinnott-1984/IUGG-GRS80"
}
}
How to call it
MCP
Connect https://computefirst.net/mcp (setup), then call execute with:
{
"id": "geo-haversine-distance",
"version": "1.0.0",
"input": {
"lat1_deg": 0,
"lon1_deg": 0,
"lat2_deg": 0,
"lon2_deg": 0,
"unit": "m"
}
}
HTTP (no key)
curl -X POST https://computefirst.net/v1/tools/geo-haversine-distance/versions/1.0.0/execute \
-H "Content-Type: application/json" \
-d '{"lat1_deg":0,"lon1_deg":0,"lat2_deg":0,"lon2_deg":0,"unit":"m"}'
The machine-readable contract is at /v1/tools/geo-haversine-distance/versions/1.0.0.
CLI
node cli.mjs run geo-haversine-distance 1.0.0 --input input.json --base-url https://computefirst.net
Get the client at /clients/cli/.
Related tools
- Geo initial bearing: Compute the initial spherical bearing from point A to point B and return degrees clockwise from true north.
- Geo destination point: Compute the spherical destination from a start point, initial bearing, and distance; return latitude and longitude.
- Affine2d apply: Apply one exact rational 2D affine map to bounded points or free vectors.
- Color contrast wcag: Compute WCAG 2.x relative luminance, contrast ratio, and AA/AAA pass flags for two opaque sRGB colors.
- Homography compose: Compose two exact 2D homographies and return a canonical projective matrix.
- Affine2d compose: Compose two exact rational 2D affine maps in first-then-second order.