Dogleg route distance calculator
A dogleg route deliberately travels from a start point through one intermediate waypoint before reaching its destination.
Run — free
This calculator measures both great-circle legs, adds them to obtain the complete dogleg distance, and compares that total with the direct great-circle distance between the endpoints. The result makes the cost of the diversion explicit as both an absolute distance and a percentage. It is useful for route planning, aviation estimates, marine passages, logistics analysis, and any workflow that needs a reproducible geometric baseline without road maps or live traffic data.
What the dogleg calculation measures
A dogleg consists of two connected segments: start to waypoint, followed by waypoint to destination. The calculator evaluates each segment as the shortest arc on a spherical Earth, then adds those two arcs to obtain the total route distance. It separately evaluates the direct start-to-destination arc. Subtracting the direct distance from the two-leg total gives the detour penalty, while dividing that penalty by the direct distance gives the percentage overhead. These values answer related but distinct questions. The total tells you how far the planned geometric route runs; the penalty tells you how much extra distance the waypoint introduces; and the percentage makes diversions comparable across routes of very different scales. The result includes both leg distances so you can see whether the waypoint divides the journey evenly or creates one disproportionately long segment. Because the method uses coordinates rather than a road or airway network, it measures surface geometry. It does not account for streets, prohibited airspace, currents, terrain, elevation, schedules, or traffic. Treat it as a consistent baseline for comparison, screening, and estimation rather than a turn-by-turn route quote.
How to enter coordinates and interpret the output
Provide latitude and longitude in decimal degrees for the start, the single waypoint, and the destination. Latitude must remain between -90 and 90, and longitude between -180 and 180. Keep the order clear: latitude is the north-south coordinate and longitude is the east-west coordinate. Swapping them may either trigger validation or, more dangerously, describe a valid but unintended place. Choose meters, kilometers, statute miles, or nautical miles for every returned distance. You may also choose the number of decimal places, which controls presentation without changing the underlying calculation. The default sphere uses the IUGG mean Earth radius of 6,371,008.8 meters; an advanced caller can supply another positive radius for a different spherical body or modeling convention. The detour penalty should be nonnegative because the direct great-circle arc is the shortest spherical path between the endpoints. Floating-point noise is clamped away before output. If start and destination coincide, there is no meaningful percentage denominator. The calculator therefore omits detour_percent when the waypoint creates nonzero travel around a zero-length direct path, while still returning every absolute distance and penalty needed to understand the route.
Using the result in planning and analysis
Use the dogleg result when a trip must pass through a hub, checkpoint, refueling location, transfer port, inspection site, or other mandatory waypoint. In logistics, compare candidate hubs by detour penalty before sending the shortlist to a costly road-routing service. In aviation or marine planning, use nautical miles to evaluate the geometric effect of an operational waypoint, while remembering that approved tracks and weather avoidance can add further distance. Analysts can calculate percentage overhead across many proposed routes and flag cases above a policy threshold, such as a transfer that adds more than ten percent to the direct baseline. The deterministic response is also suitable for regression fixtures, spreadsheets, and audit trails: identical inputs, radius, unit, and precision always produce identical fields. A request costs $0.002 through the API, and the browser version can be used for interactive checks. Do not interpret this output as travel time or fuel burn by itself. Those depend on speed, vehicle characteristics, winds, congestion, gradients, stops, and route constraints. Instead, feed the returned leg and total distances into the relevant operational model, or use the penalty as a transparent first-stage ranking signal before obtaining network-aware directions.
What you can do with it
Compare distribution hubs
Measure how much extra great-circle distance each candidate warehouse or transfer hub adds between an origin and destination.
Evaluate a required checkpoint
Quantify the absolute and percentage diversion created by an inspection point, border crossing, or service stop.
Screen aviation or marine waypoints
Calculate two-leg distance in nautical miles before applying weather, airspace, current, or navigation constraints.
FAQ
What is a dogleg route?
It is a two-leg route that goes from a start point through one intermediate waypoint and then to the final destination.
How is the detour penalty calculated?
The calculator subtracts the direct great-circle distance from the sum of the start-to-waypoint and waypoint-to-destination distances.
Does this calculate driving or flight-plan distance?
No. It calculates spherical great-circle arcs between coordinates. Roads, approved tracks, terrain, traffic, and other constraints are not included.
Which distance units are supported?
You can request meters (m), kilometers (km), statute miles (mi), or nautical miles (nmi).
What happens when the start and destination are identical?
The direct distance is zero. Absolute leg, total, and penalty distances are still returned; a percentage is returned only when it has a meaningful denominator.
How much does an API request cost?
Each successful API request costs $0.002. Invalid input is rejected before calculation.
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/dogleg-distance \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"start_lat":40.7128,"start_lon":-74.006,"waypoint_lat":41.8781,"waypoint_lon":-87.6298,"end_lat":34.0522,"end_lon":-118.2437}'const res = await fetch("https://api.kit.forhosting.com/geo/dogleg-distance", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"start_lat": 40.7128,
"start_lon": -74.006,
"waypoint_lat": 41.8781,
"waypoint_lon": -87.6298,
"end_lat": 34.0522,
"end_lon": -118.2437
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geo/dogleg-distance",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"start_lat": 40.7128,
"start_lon": -74.006,
"waypoint_lat": 41.8781,
"waypoint_lon": -87.6298,
"end_lat": 34.0522,
"end_lon": -118.2437
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geo/dogleg-distance", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"start_lat":40.7128,"start_lon":-74.006,"waypoint_lat":41.8781,"waypoint_lon":-87.6298,"end_lat":34.0522,"end_lon":-118.2437}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"start_lat":40.7128,"start_lon":-74.006,"waypoint_lat":41.8781,"waypoint_lon":-87.6298,"end_lat":34.0522,"end_lon":-118.2437}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geo/dogleg-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
{
"start_lat": 40.7128,
"start_lon": -74.006,
"waypoint_lat": 41.8781,
"waypoint_lon": -87.6298,
"end_lat": 34.0522,
"end_lon": -118.2437
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geo.dogleg_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.
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. |