Polygon edge bearings
For the square (0, 0), (0, 1), (1, 1), (1, 0), the four edges head 90°, 0°, 270.008726° and 180° from true north, with the last edge closing back to the start. Every segment gets its own great-circle starting direction. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- Precision
- 6
- Vertex count
- 4 degrees
- Edge count
- 4
- Reference
- true_north
Polygon edge bearings turn an ordered list of geographic vertices into a direction for every segment. Supply latitude and longitude records, choose whether the geometry closes back to its first point, and receive initial great-circle bearings measured clockwise from true north.
Prepare ordered vertices for a polygon or polyline
Enter vertices in the order that the geometry should be traversed. Each row has a lat value from -90 through 90 and a lon value from -180 through 180, both expressed in decimal degrees. The order matters because reversing the vertices reverses every segment and therefore changes each bearing.
By default, closed is true: the calculator treats the input as a polygon ring and adds the final edge from the last vertex back to the first. Set closed to false when the input represents a polyline, trail, survey traverse, or route that has distinct start and end points. You may include the first vertex again at the end of a closed ring; the calculator removes that conventional duplicate before it creates edges, so the output does not contain a meaningless extra segment.
A closed polygon needs at least three normalized vertices, while an open polyline needs at least two. Consecutive duplicate points are rejected because a zero-length edge has no geographic direction. Keep coordinates as numbers rather than formatted compass strings, and confirm whether your source uses latitude-longitude or longitude-latitude order before pasting data.
Understand the bearing returned for every edge
A value of 0 points toward true north, 90 east, 180 south, and 270 west. Values are normalized into the half-open range from 0 inclusive to 360 exclusive, which avoids two representations for north. On a sphere, the local direction of a great-circle path can change as the path progresses, especially at high latitudes or over continental distances.
The precision option controls decimal places from zero through twelve and defaults to six. Rounding is for stable display and machine comparison; it does not imply survey-grade accuracy. Each successful response also states that the reference is true north and the unit is degrees so downstream software does not need to infer those conventions.
Apply edge bearings safely in mapping workflows
Edge-by-edge azimuths are useful whenever a geometry must be inspected, annotated, or converted into human-readable directions. A mapping application can rotate labels or arrow symbols to match boundary segments. A field team can compare the expected direction between consecutive control points with a measured traverse.
A data-quality pipeline can flag sudden reversals, repeated coordinates, or segment directions outside an expected corridor before publishing a layer. The calculation is deterministic and local: it performs bounded trigonometry over the submitted records, makes no geocoding request, and does not consult road networks, terrain, obstacles, or legal boundary sources. That distinction matters.
A bearing describes angular direction between coordinates; it does not prove that movement along the straight geodesic is possible or authorized. For cadastral, engineering, aviation, or safety-critical work, use an appropriate ellipsoidal geodesic library and verified coordinate reference system, then treat this spherical result as an inspection aid rather than the final authority. For ordinary web maps, educational exercises, preliminary route checks, and repeatable automation, the spherical forward-azimuth formula offers a clear and portable result.
What you can do with it
Annotate polygon boundaries
Rotate direction arrows or label each boundary segment with its true-north azimuth while preserving the original vertex indexes.
Inspect route geometry
Calculate each open polyline segment bearing to find unexpected reversals or compare a planned sequence with field notes.
Prepare survey-style summaries
Turn ordered control points into a deterministic edge table for preliminary review before authoritative geodetic processing.
FAQ
Does the calculator close the polygon automatically?
Yes. The closed option defaults to true, so the final vertex connects to the first. Set it to false for an open polyline.
What happens if the first vertex is repeated at the end?
One repeated closing vertex is removed before edges are calculated. This avoids creating a zero-length closing segment.
Are bearings measured from magnetic north?
No. Bearings are clockwise from true north. Apply an appropriate local magnetic declination separately if a magnetic compass heading is required.
Can I use it for an open route instead of a polygon?
Yes. Turn off the option that closes the shape and no edge is added from the last point back to the first. A route then needs at least two points, while a closed polygon needs three.
Why is an east-west edge not exactly 270 degrees?
Each bearing is the direction of the shortest path on the sphere at the moment it leaves the first point. That direction shifts along the way, so the third edge in the example starts at 270.008726 rather than 270.
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/polygon-edge-bearings \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"vertices":[{"lat":0,"lon":0},{"lat":0,"lon":1},{"lat":1,"lon":1},{"lat":1,"lon":0}]}'const res = await fetch("https://api.kit.forhosting.com/geo/polygon-edge-bearings", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"vertices": [
{
"lat": 0,
"lon": 0
},
{
"lat": 0,
"lon": 1
},
{
"lat": 1,
"lon": 1
},
{
"lat": 1,
"lon": 0
}
]
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/geo/polygon-edge-bearings",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"vertices": [
{
"lat": 0,
"lon": 0
},
{
"lat": 0,
"lon": 1
},
{
"lat": 1,
"lon": 1
},
{
"lat": 1,
"lon": 0
}
]
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/geo/polygon-edge-bearings", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"vertices":[{"lat":0,"lon":0},{"lat":0,"lon":1},{"lat":1,"lon":1},{"lat":1,"lon":0}]}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"vertices":[{"lat":0,"lon":0},{"lat":0,"lon":1},{"lat":1,"lon":1},{"lat":1,"lon":0}]}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/geo/polygon-edge-bearings", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"vertices": [
{
"lat": 0,
"lon": 0
},
{
"lat": 0,
"lon": 1
},
{
"lat": 1,
"lon": 1
},
{
"lat": 1,
"lon": 0
}
]
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "geo.polygon_edge_bearings",
"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. |
Technical notes
The result preserves vertex and edge indexes, echoes both endpoints, and applies consistent rounding, making it suitable for map labels, route inspection, field instructions, quality checks, and automated geographic data pipelines without a network lookup or a routing service.
Understand the bearing returned for every edge
Every output edge identifies its zero-based index, its source and destination vertex indexes, the two coordinate records, and bearing_deg. The calculator uses the initial great-circle bearing, also called the forward azimuth: it is the direction of the shortest spherical path at the moment it leaves the first endpoint. This is not magnetic heading, because no local magnetic declination is applied. It is also not necessarily a constant course along a long edge.
Apply edge bearings safely in mapping workflows
The browser calculation is available locally, while API automation uses the published base price of $0.002 per successful request.
Technical questions
Why are consecutive duplicate vertices rejected?
An edge whose endpoints are identical has zero length and no defined direction, so the request returns an invalid_input error instead of inventing a bearing.
How much does the API request cost?
A successful API request uses the published base price of $0.002. The same deterministic calculation can also run in the browser.