Equirectangular distance
From 40.7128, -74.006 to 40.758, -73.9855 the equirectangular shortcut gives 5314.523521 m, or 5.314524 km. It scales longitude by the cosine of the mean latitude, which suits nearby points and map filters. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Lat1
- 40.7128
- Lon1
- -74.006
- Lat2
- 40.758
- Lon2
- -73.9855
- Distance m
- 5,314.523521
- Distance km
- 5.314524
- Distance mi
- 3.302292
- Earth radius m
- 6,371,000
An equirectangular distance calculator answers a simple mapping question: how far apart are two nearby latitude and longitude points when you need a fast answer rather than a full geodesic. Enter four decimal-degree coordinates; the tool projects the separation onto a local plane that scales longitude by the cosine of the mean latitude, multiplies the resulting angular length by the mean Earth radius, and returns distance in meters, kilometres, and miles with substitution steps. That approximation is the classic GIS shortcut used in bounding-box filters, mobile “nearby” queries, and classroom demos where every millisecond of haversine overhead is wasted on city-scale hops.
What the equirectangular approximation computes
On a sphere of radius R the shortest surface path between two points is a great-circle arc, usually evaluated with the haversine formula or an ellipsoidal geodesic.
When the two points are close—blocks, neighbourhoods, short delivery legs—the sphere is almost flat and a cheaper projection works well: convert latitude and longitude differences to radians, form the mean latitude φm equals (φ1 plus φ2) over two, scale the longitude difference by cos(φm) so east–west metres shrink toward the poles, then take the Euclidean length of the vector (Δλ cos φm, Δφ) and multiply by R. That is the equirectangular approximation, also called the flat-Earth or mean-latitude formula in many GIS textbooks.
It does not model Earth flattening, altitude, or long-haul antimeridian routes with the same fidelity as Vincenty or Karney methods; error grows as the points separate or as you approach the poles where the cosine scale changes rapidly. When start and end coincide, the distance is exactly zero.
Practical tips, limits, and related searches
Use this landing when you already know the two points are nearby and you want the classic fast formula rather than a heavy geodesic library: store geofence radii, pre-filter map markers, grade homework that asks for the equirectangular distance, or generate stable expected values for mobile client tests. Prefer a haversine or ellipsoidal tool when separations span hundreds of kilometres, when legal survey precision matters, or when one point sits near a geographic pole where planar scaling degrades.
Keep coordinates in decimal degrees WGS84; do not pass DMS strings or projected eastings here—convert first with a dedicated converter. Pair it with bounding-box or rhumb-bearing helpers when your pipeline needs both a coarse distance filter and a constant-course azimuth for the same nearby pair.
What you can do with it
Nearby-marker pre-filters on maps
Web and mobile clients drop markers farther than a radius by computing equirectangular metres first, then only run heavier haversine checks on the shortlist.
Delivery and IoT proximity checks
Edge workers compare successive GPS fixes with a cheap planar distance before deciding whether a device crossed a local geofence.
FAQ
What is the equirectangular distance formula?
With latitudes and longitudes in radians, φm = (φ1+φ2)/2, d = R · √((Δλ·cos(φm))² + (Δφ)²).
When should I use equirectangular instead of haversine?
Use equirectangular for nearby points (city scale or less) where speed and simplicity matter. Use haversine or an ellipsoidal geodesic for long distances or survey-grade work.
What happens if a coordinate is out of range?
The message states that the coordinate is outside its valid range.
Does this account for Earth flattening?
No. It models a sphere with fixed mean radius. Ellipsoidal methods (Vincenty, Karney) are better when flattening matters.
Is the equirectangular distance calculator free?
The browser tool is free and runs locally.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/geo/equirectangular-distance \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"lat1":40.7128,"lon1":-74.006,"lat2":40.758,"lon2":-73.9855}'const res = await fetch("https://api.kit.forhosting.com/geo/equirectangular-distance", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"lat1": 40.7128,
"lon1": -74.006,
"lat2": 40.758,
"lon2": -73.9855
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geo/equirectangular-distance",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"lat1": 40.7128,
"lon1": -74.006,
"lat2": 40.758,
"lon2": -73.9855
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geo/equirectangular-distance", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"lat1":40.7128,"lon1":-74.006,"lat2":40.758,"lon2":-73.9855}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"lat1":40.7128,"lon1":-74.006,"lat2":40.758,"lon2":-73.9855}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geo/equirectangular-distance", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"lat1": 40.7128,
"lon1": -74.006,
"lat2": 40.758,
"lon2": -73.9855
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geo.equirectangular_distance",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
lat_min | -90 |
lat_max | 90 |
lon_min | -180 |
lon_max | 180 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Coordinates outside the legal latitude or longitude ranges are rejected with a clear invalid_input error so bad GPS dumps never silently invent a distance.
How to call the API and what comes back
Latitude must lie in the closed interval from minus ninety to ninety degrees; longitude must lie in the closed interval from minus one hundred eighty to one hundred eighty degrees. Longitude differences that cross the antimeridian are folded into the shortest angular span so a pair near plus or minus one hundred eighty degrees still measures the short nearby hop instead of almost the whole Earth. Send a JSON body with four required finite numbers: lat1 and lon1 for the first point (aliases start_lat, latitude1, from_lat, start_lon, longitude1, from_lon, lng1) and lat2 and lon2 for the second (aliases end_lat, latitude2, to_lat, end_lon, longitude2, to_lon, lng2). On success the response echoes the rounded coordinates, sets distance_m, distance_km, and distance_mi to the equirectangular length under the fixed Earth radius, publishes earth_radius_m and mean_lat_deg for auditability, names method as equirectangular, includes the formula string, a units map, a short English message, and an ordered steps array that shows Δφ, antimeridian-normalized Δλ, the scaled x and y components, and the final metre product. Failed validation—missing fields, non-finite values, or any coordinate outside its valid range—returns invalid_input and is never charged. Pricing is a flat $0.002 per successful request with unit item and zero marginal unit price.
Practical tips, limits, and related searches
Round-trip checks are easy: recompute Δφ and Δλ by hand, multiply Δλ by cos of mean latitude in radians, take the hypotenuse, multiply by six million three hundred seventy-one thousand, and confirm distance_m within the published six-decimal rounding. Failed tasks that return invalid_input do not consume prepaid balance, which keeps exploratory scripts cheap when you deliberately send latitude ninety-one to exercise error paths. This page targets people searching for equirectangular distance approximation, fast lat lon distance, or mean-latitude planar distance online; it is not a full routing engine, not a map tile projector, and not a substitute for great-circle aviation calculations.
Integration use cases
Homework and GIS lab expected values
Instructors publish four coordinates and grade students against the same fixed-R equirectangular distance the API returns deterministically.