ForHosting KIT · Travel & geography

Terrain line of sight calculator

Check whether a straight line of sight clears the terrain between observer and target: over the profile 100, 105, 120, 110 and 95 m with the eye 1.7 m up, the ray is blocked and passes 21.65 m below the 120 m ridge. Free in your browser.

  • Free
  • Runs in your browser
  • No sign-up
  • Your data stays on your device
Use it from WebAPIEmailTelegramApp soon

Runs in your browser. Free, unlimited — your data never leaves this page.

Line of sight over terrain is the geometric question behind radio links, rifle ranges, trail cameras, drone paths, and simple viewshed checks when you already hold a height profile along a path. This terrain line of sight calculator takes an ordered series of ground elevations from observer to target, plus the height of the eye or antenna above the first sample and the height of the object above the last sample, and reports whether the straight ray clears every intervening sample. The model is flat-Earth with equal horizontal spacing between profile points—fast, deterministic, and easy to wire into scripts that already extracted elevations from a DEM or survey. When the ray dips below the ground at any sample the response marks the path blocked and names the first blocking index.

How the terrain line-of-sight model works

Imagine walking a straight ground track from an observer to a target while sampling elevation at regular horizontal steps. The first sample is the ground under the observer; the last is the ground under the target; every value in between is intervening terrain. On a flat-Earth sketch the clear ray is the straight line connecting those two elevated points.

At sample index i of n total samples the fractional distance along the path is t equals i divided by n minus one. Clearance at sample i is that geometric height minus the terrain elevation at i. If every clearance is greater than or equal to zero, the path is clear—including grazing contact that just touches a ridgeline.

If any clearance is strictly negative, the ray is blocked by solid ground at that sample. Curvature of the Earth, refraction, and vegetation are deliberately out of scope: feed a profile that already includes those corrections if your engineering standard requires them, or use this tool as the pure geometric core of a larger pipeline.

Who uses a terrain line of sight check

Survey and GIS notebooks often already hold a list of DEM samples along a planned microwave hop, trail camera bearing, or hiking viewpoint; this calculator answers the binary clear-or-blocked question without standing up a full viewshed stack. Radio planners can batch thousands of candidate paths in edge workers because the algorithm is pure arithmetic with no outbound network. Game and simulation tools that store heightmaps can export a 1-D slice and reuse the same contract for AI visibility checks.

Failed validation does not consume balance. Keep profiles under five thousand samples, pin rounded clearances in tests, and you get reproducible LOS decisions for field kits, LMS demos, and production pipelines without a GIS server of your own.

Radio and microwave path checks

Feed DEM samples along a hop plus antenna heights to see whether the geometric ray clears intermediate terrain before running a full link budget.

Range, trail, and camera siting

Test whether a ridge blocks the line from a standing or bipod observer to a target, flag, or trail-camera subject using a short elevation profile.

Simulation and game visibility slices

Export a 1-D heightmap slice between two entities and reuse the clear/blocked contract for deterministic AI line-of-sight tests.

What units should I use for the profile and heights?

Metres for every elevation and height field. Keep the profile and heights in the same unit system; the math is unit-consistent as long as you do not mix feet and metres.

Does the tool account for Earth curvature or refraction?

No. The model is flat-Earth geometry on your supplied profile.

What if my profile has only two points?

With non-negative heights the path is always clear for two samples; intervening terrain needs middle samples.

What does the minimum clearance tell me?

It is the smallest gap between the sight line and the ground along the profile, together with the sample where it occurs. A negative value means the ground rises above the ray: in the example it is −21.65 m at the 120 m ridge, so you see how far off a near-miss is.

Does a ray that just grazes a ridge count as clear?

Yes. The path is clear when the ray stays at or above every sample, so touching a ridgeline exactly still counts as clear. It is blocked only when the ground rises strictly above the ray at some point along the profile.

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/line-of-sight

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/line-of-sight \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"profile":[100,105,120,110,95],"observer_height":1.7,"target_height":0}'
{
  "profile": [
    100,
    105,
    120,
    110,
    95
  ],
  "observer_height": 1.7,
  "target_height": 0
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "geo.line_of_sight",
  "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.

How the terrain line-of-sight model works

The observer’s eye (or antenna feed point) sits observer_height metres above the first sample, and the target tip sits target_height metres above the last sample. The geometric height of the line of sight at that fraction is eye0 plus t times (eye1 minus eye0), where eye0 and eye1 are the elevated endpoints. This endpoint returns the global minimum clearance and its index so you can see how close a near-miss was, and on a blocked path it also returns the first blocking index with the terrain and line-of-sight elevations there. Optional distance_m scales the report so sample spacing appears in metres; it does not change the clear or blocked decision, because equal spacing is already assumed in the index fractions.

Input contract, response fields, and validation

Example: profile one hundred, one hundred five, one hundred twenty, one hundred ten, ninety-five with observer height one point seven metres, target height zero, and distance one thousand metres will report blocked if the ridge at one hundred twenty metres pierces the ray, or clear if the heights lift the ray above every peak. POST a JSON body with profile, an array of at least two finite numbers giving terrain elevations in metres from observer ground to target ground; observer_height, a non-negative finite number of metres of eye or antenna above the first sample; and target_height, a non-negative finite number of metres of object height above the last sample. Optional distance_m is the total horizontal path length in metres when you want sample_spacing_m in the response. Aliases accepted for convenience include terrain, elevations, and samples for the profile; observer_h, h_obs, and eye_height for the observer; target_h, h_tgt, and object_height for the target; and distance, range_m, or path_length_m for the path length. Missing required fields, non-finite values, negative heights, a profile shorter than two samples, or more than five thousand samples fail with invalid_input naming the problem; those failures are not billed. On success the body always includes clear (boolean), sample_count, observer_eye_elev and target_eye_elev (absolute elevations of the ray endpoints), min_clearance_m and min_clearance_index (the tightest sample, which may still be positive on a clear path), and a short formula string restating the test. When distance_m was supplied, distance_m and sample_spacing_m are echoed and derived. When clear is false, blocked_at_index, terrain_elev_at_block, and los_elev_at_block identify the first sample where clearance went negative.

Where a terrain LOS API earns its keep

Outdoor educators and range officers can paste a short elevation series from a phone app and see whether a ridge blocks the line to a flag or target, adjusting observer_height for bipod versus standing and target_height for a steel plate versus a ground stake.

How does the terrain line of sight calculator decide clear vs blocked?

It builds a straight ray from profile[0]+observer_height to profile[n−1]+target_height and checks clearance at every equally spaced sample. If any sample has los_z − terrain < 0, the path is blocked; otherwise it is clear (grazing counts as clear).

What does the terrain line of sight tool cost?

The browser tool is free. API requests use prepaid KIT balance at $0.002 per successful call; invalid input is not billed.

Read the full KIT documentation →