ForHosting KIT · Developer Utilities

Point to infinite great-circle line distance calculator

This point-to-infinite-line distance calculator measures the shortest spherical distance from one latitude-longitude coordinate to the complete great circle determined by two other coordinates.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Unlike a segment calculator, it does not stop at either defining point: the line continues around the globe in both directions. The result includes metres, kilometres, and angular degrees, uses the mean Earth radius by default, and accepts a custom spherical radius when another planetary body or geometric scale is required.

Define the point and the infinite great-circle line

Enter the query coordinate as point_lat and point_lon, then provide two coordinates that lie on the intended line. Those defining coordinates are line_start_lat with line_start_lon and line_end_lat with line_end_lon. They choose a great circle, which is the intersection between the sphere and a plane passing through the sphere's centre. The calculation treats that circle as an infinite line: it continues beyond both supplied coordinates and eventually wraps around the globe. This distinction matters when the closest perpendicular foot falls outside the shorter arc between the defining points. A route-segment calculation would then select an endpoint, while this capability still measures to the extended great circle. Latitude must remain between -90 and 90 degrees, and longitude between -180 and 180 degrees. The defining coordinates cannot be identical or antipodal, because either case fails to identify one unique plane. Decimal-degree inputs may be numbers or strict numeric strings, making the endpoint practical for form submissions as well as structured API calls.

Understand the spherical calculation and its output

Each coordinate is converted into a three-dimensional unit vector from the sphere's centre. The cross product of the two line vectors gives a normal to the great circle's plane. After normalizing that vector, the absolute dot product with the query-point vector gives the sine of the perpendicular angular separation. Taking the inverse sine produces the smallest unsigned angle from the point to the great circle. Multiplying that angle by radius_m produces distance_m, while distance_km is the same value divided by one thousand. The response also includes angular_distance_deg for users working directly with spherical angles. The default radius is 6,371,008.8 metres, the IUGG mean Earth radius, but a positive custom radius can model a different sphere. This is a spherical calculation rather than an ellipsoidal geodesic solution, so it is appropriate for general navigation, mapping checks, education, and global-scale estimates. The method avoids planar longitude distortion and naturally handles lines that cross the antimeridian, because the vector representation has no longitude seam.

Interpret the shortest distance correctly

The returned distance is always nonnegative and answers one precise question: how far is the query point from the nearest location anywhere on the complete great circle? It does not report whether the point lies left or right of a directed route, how far along the route the perpendicular foot occurs, or whether that foot is between the two defining coordinates. Those are route-oriented questions and require signed cross-track or segment logic. A zero result means the point lies on the same great-circle plane within floating-point precision, even when it is far beyond the supplied arc. When comparing the value with local survey measurements, remember that Earth is represented by a sphere. Real Earth is an oblate ellipsoid, terrain adds elevation, and practical travel paths may follow roads or restricted airspace rather than a geodesic. For reproducible automated work, store the input radius beside the result. Also preserve the defining-point order only if another calculation needs direction; reversing them changes the plane normal's sign but cannot change this capability's absolute perpendicular distance.

Check proximity to an extended flight-path great circle

Measure how far a waypoint sits from the complete geodesic defined by two route coordinates, even when the nearest foot is beyond the supplied arc.

Validate global map geometry

Test whether coordinates intended to share one great circle are within an acceptable spherical tolerance without projecting them onto a flat map.

Model another spherical body

Supply a custom radius to calculate the analogous perpendicular distance for a planet, moon, globe, or abstract sphere.

What does an API request cost?

Each API request costs $0.002. The browser calculator can run locally for free.

Is the line limited to the arc between the two defining points?

No. The calculation uses the complete great circle extending through and beyond both points in both directions.

Why are identical or antipodal line points rejected?

Neither pair identifies one unique great-circle plane, so the requested line would be ambiguous.

Does the calculator use the WGS 84 ellipsoid?

No. It uses a sphere with the IUGG mean Earth radius by default, or a custom radius supplied by the caller.

Does reversing the two line points change the answer?

No. Reversal flips the plane normal, but the absolute perpendicular distance remains the same.

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.

POSThttps://api.kit.forhosting.com/geo/point-to-line-distance

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.

curl -X POST https://api.kit.forhosting.com/geo/point-to-line-distance \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"point_lat":10,"point_lon":20,"line_start_lat":0,"line_start_lon":0,"line_end_lat":0,"line_end_lon":90}'
{
  "point_lat": 10,
  "point_lon": 20,
  "line_start_lat": 0,
  "line_start_lon": 0,
  "line_end_lat": 0,
  "line_end_lon": 90
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geo.point_to_line_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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →