Distance Between Coordinates, Geohash & Polyline Online
Distance (haversine, Vincenty), bearing, destination, geohash, Google polyline, point in polygon, area, simplification and nearest points.
Result
Press “Run” to see the result.
Pick an operation with op. distance (from, to) gives the great-circle distance (haversine) and the ellipsoidal distance on WGS 84 (Vincenty, millimetre accuracy) in metres, kilometres, miles and nautical miles, the initial and final bearing, compass direction and midpoint. destination gives the point reached from from after distance metres on a bearing. geohash encodes a point (precision 1-12) or decodes a geohash to its centre, bounding box, cell size and 8 neighbours. polyline encodes points to a Google encoded polyline or decodes a polyline (precision 5, or 6 for OSRM / Valhalla), with its length.
contains tells whether a point or a list of points lies inside a GeoJSON polygon (Polygon with holes, MultiPolygon, Feature or FeatureCollection, returning the matching features). measure gives the area (m², km², ha), perimeter, line length, bounding box and centroid of any GeoJSON. simplify reduces a line or polygon with Douglas-Peucker for a tolerance in metres. nearest sorts up to 10,000 points by distance from from (with limit and max_distance).
Points are "lat,lng", [lat, lng] or {"lat", "lng"} in WGS 84 degrees; GeoJSON keeps its own [lng, lat] order (RFC 7946). Pure calculation, nothing is stored; no routing or geocoding (see /v1/vn-geo for Vietnamese administrative units).
Use this in your code
curl "https://apibox.io.vn/v1/geo-tools?op=distance&from=21.0285,105.8542&to=10.7769,106.7009" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/geo-tools?op=distance&from=21.0285,105.8542&to=10.7769,106.7009', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/geo-tools?op=distance&from=21.0285,105.8542&to=10.7769,106.7009",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/geo-tools?op=distance&from=21.0285,105.8542&to=10.7769,106.7009');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Haversine or Vincenty?
Haversine uses a sphere and can be off by up to about 0.5%; Vincenty uses the WGS 84 ellipsoid and is accurate to the millimetre. Both are returned.
Which coordinate order do you use?
Points are lat, lng (as on phones and maps); GeoJSON input and output use lng, lat as required by the standard.
How is area computed?
With the spherical excess formula used by turf.js (radius 6378137 m), holes subtracted; accurate enough for parcels, wards and delivery zones.