3

I'm involved in a project using GDAL via python.

We need to be able to calculate if, standing at point A it is possible to see point B, given a DEM. To clarify we do not need a viewshed algoritm, we would only like to know if there is a straight unbroken line from A to B.

  • Are there any well known algorithms for line-of-sight calculations?
  • Is there a GDAL module or python script (using GDAL) that can do LOS calculation?
  • GRASS has modules to calculate view-shed and LOS. See r.viewshed and r.los. In GRASS 7.x you can call them from a python script. – Zoltan Feb 16 '17 at 16:22
4

You mention that you don't want a full viewshed (i.e. a raster output), which suggests that a simple point-to-point intervisibility is more what you're after.

There is a QGIS plugin called Viewshed analysis. As well as the usual raster options, this also has an intervisibility vector option.

If you have a layer with a number of points, scattered over the DEM, you can get it to draw lines between any pairs of points which are mutually intervisible, like so:-

enter image description here

(in this case I added 200 points at random on a DEM, and chose to show only pairs which are mutually visible)

The options look like this. Make sure to choose a radius in Map Units, and make sure to complete both layer names - if you don't, you'll end up with one raster per point :-)

enter image description here

As it's a plugin, rather than a processing algorithm, it's not amenable to scripting unfortunately.. but it's open source, so you might be able to look at the source to see how this is implemented.

The code repo also has a .bib file with links to papers which might be of interest

  • Thank you for the thorough answer. We managed to write our own python module for extracting a "straight" line in a raster between two points. In the end it was quite similar to a method in the doViewshed.py file from the source-code you suggested. We could then use the histogram we get to calculate inter-visibility between the points. – Gabriel Tigerström Mar 1 '17 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.