# Computing View Distance in One Direction from Point on Elevation Raster in PostGIS?

I'm a software developer just getting into GIS, so please forgive me if I don't use proper lingo, or if I use proper lingo incorrectly!

I have a raster of elevation data. For a given point in the raster, I'd like to compute how far one can "see" from that point in each of the 4 cardinal directions.

I'm assuming that all obstructions are accounted for in the elevation data, that the Earth is flat, and that the whole region I care about is represented in the raster. Also, let's assume the viewer is 5 feet tall. So, we can reduce this to a problem of "How many squares in the raster can I 'see' before I either (a) hit a square that has `elevation>=myelevation+5ft`, or (b) leave the rasterized region?"

If I simply had to write a program to compute this, I'd do a simple traversal in each direction until I hit a square that matched my criteria. Or, if I wanted the 360° view, I could use a "flood fill"-style algorithm to do that, too. However, I have no idea how to do this in a "GIS-y" way!

Based on what I've read, it feels like there should be a ST_MapAlgebra solution, but I haven't been able to put my finger on it.

If I could get a "visible region" that looks out in 360° -- so all the continguous raster squares I can see from the given square -- that would be even better!

• The term/lingo you need is "viewshed". – user2856 Mar 22 '15 at 7:52

Viewsheds have been mentioned. These will show which grid cells are visible from a given point. They don't tell you the distance, however.

If it's the distance you're after, SAGA GIS has the ability to do this. The tool is under Terrain Analysis > Lighting > Visibility

You can either specify one or more observer coordinates from a shape layer, or use 'interactive' mode and the action tool to select a single observer.

The dialog settings should look like this... use 'distance' mode.

You get a similar output to viewshed, but each visible cell's value is set to the distance from the observer, rather than just a 'visible/not visible' value.

Here's an an example showing the distances from an observer at sea to the North-East of Kerguelen Islands. I've graduated the raster by distance...

I'm not sure whether this takes into account the Earth's curvature, but this may not be a problem if distances are small.

you can use line of sight tool in arcgis , for more details http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00q8000000pz000000

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

• Welcome to GIS SE! As a new user be sure to take the Tour. Here you are providing a very brief answer based on ArcGIS Desktop but the question makes no mention of that software being used. – PolyGeo Aug 13 '15 at 7:45