Visibility analysis for QGIS 2 (0.5 version)
The plugin cannot be installed from the official QGIS repository (the QGIS 3 version is hosted there…); you will need to do a manual install.
Find the QGIS 2 version in the repository branch QGIS-2, and download the code.
Locate your QGIS plugins folder. On Windows it would be
C:\users\username\.qgis2\python\pluginsand on Linux something like
~/home/.qgis2/python/plugins. (do a file search for
Plugin code can then be extracted in a new folder inside the plugins folder (you should name the folder ViewshedAnalysis). Take care that the code is not inside a subfolder - the folder structure should be like this:
├─── [some QGIS plugin folders…]
. ├── viewshedanalysis.py
. ├── [other files and folders…]
- Be sure to enable the plugin in Plugins manager: it should then be visible in Plugins menu.
2. Input and features
This can be any supported raster format, normally a terrain elevation model. Resulting viewshed model has the same resolution and extent as the original terrain data: for better performance and for convenience the terrain model should be cropped to the analysed area. Raster data format has to match the format of parameters: e.g. parameters specified in metres over a raster in degrees will not make a sensible result.
Observer points have to be stored in a shapefile or other recognised vector formats. Lines or polygons cannot be used (unless broken up in points).
The coordinate reference systems of the elevation raster and the observer/target point(s) must match. There is no ‘on the fly reprojection’ or whatever: the best practice is to turn off automatic reprojection to test whether things overlap as they should.
Unless cumulative output is chosen in algorithm options, a viewshed raster will be produced for each point. Files will be named using an internal Id number or by value specified in ID column in the associated data table, in case such field exists. Take care that these values be unique (no warning is issued if otherwise!).
This option is used for intervisibility analysis only. Target points behave the same way as observer points.
A basic requirement in viewshed modelling is setting up height values for both the observer and the target. For instance we might be interested whether a building 20 metres tall (target height) would be visible by an average pedestrian with eye-level at 1.6 metres (observer height).
Observer/target height values can be read from shapefile’s data table for each observer or target point (a valid table field has to be chosen in the dropdown list). In case of error (eg. an empty field) the global value specified in the text box will be applied.
Search radius is the size of the analysed area around each observer point.
Adapt to the highest point: often it is desirable to perform a local search for a higher observation point. The search is made in a quadrangular window where the observer point is in the middle.
Viewshed will produce a standard true/false (binary) raster. Multiple viewsheds can be combined in a one raster layer using the cumulative option, otherwise a single file will be saved for each observer point.
A network of visual relationships between two sets of points (or within a single set) can be obtained with the intervisibility option. For each link the depth below/above horizon and the length are calculated. All possible links are shown in the output - the information on whether a link is successful is contained in the “Visible” column of the produced shapefile.
Using the invisibility depth we can measure the depth of terrain below the lowest possible line of sight. However, when this option is used with the target height the measurement is made from the top of the target (terrain + target): in cases when the target is partially occluded we obtain its apparent height.
Horizon is the last visible place on the terrain, which corresponds to fringes of visible zones. Here the horizon analysis will provide outer fringes of all visible patches (to be refined in future).
This options sums up all viewsheds from specified observer points into a single raster.
Earth curvature and light refraction
Similar to other viewshed algorithms available, it is possible to account for effects of the Earth’s curvature and refraction of the light when travelling through the atmosphere. Following formula is used to adjust height values in the DEM:
z adjusted = z - (Dist 2 / Diam Earth ) * (1 - Refraction)
Dist: The planimetric distance between the observation point and the target point.
Refraction: The refractivity coefficient of light (normally it has the opposite, but smaller, effect than the curvature).
Diam: The diameter of the earth that is calculated as Semi-major axis + Semi-minor axis. These values are taken from the projection system assigned to the Raster by QGIS. In case of error or unrealistic values, the default Semi-major axis of 6378137 meters and flattening of 298.257 are used.
For more explanation cf. ArcGIS web page
Three levels of precision to speed ratio are available:
- Coarse: no interpolation between pixels, lines of sight are cast to the specified perimeter.
- Normal: values are interpolated between pixels, lines of sight are cast to the specified perimeter.
- Fine: values are interpolated between pixels, lines of sight are cast to artificially enlarged perimeter (two times the specified value).
For more explanation cf. project site
3. Common problems
- There is no transformation of coordinate reference systems between the raster DEM and the observation/target points shapefile. In order to check whether they match properly simply disable ‘on-the-fly’ transformation.
- Special/international characters (e.g. ç, é, č, đ …) are not supported for file names (or folder names).
- The observer/target points are approximated to the centre of pixels they occupy: there is no need for super-precision.
- The speed of execution is related primarily to the radius of analysis, and then to the complexity of chosen options and overall size of the DEM used.
- The module loads the entire chunk of data to be analysed into memory: the volume of the analysis is limited by your hardware resources. Some options may be more memory hungry, such as target height offset or Earth’s curvature calculation. Consider using Grass viewshed modules for calculations over large datasets.
Viewshed plugin will raise an error when using too large datasets.