gdal_viewshed

Calculates a viewshed raster from an input raster DEM using method defined in [Wang2000] for a user defined point.

Synopsis

gdal_viewshed [-b <band>] [-inodata]
              [-snodata n] [-f <formatname>]
              [-oz <observer_height>] [-tz <target_height>] [-md <max_distance>]
              [-ox <observer_x>] [-oy <observer_y>]
              [-vv <visibility>] [-iv <invisibility>]
              [-ov <out_of_range>] [-cc <curvature_coef>]
              [[-co NAME=VALUE] ...]
              [-q]
              <src_filename> <dst_filename>

Description

The gdal_viewshed generates a 0-1 visibility raster with 1 band from the input raster elevation model (DEM).

New in version 3.1.0.

-co <NAME=VALUE>

Many formats have one or more optional creation options that can be used to control particulars about the file created. For instance, the GeoTIFF driver supports creation options to control compression, and whether the file should be tiled.

The creation options available vary by format driver, and some simple formats have no creation options at all. A list of options supported for a format can be listed with the –formats command line option but the documentation for the format is the definitive source of information on driver creation options. See Raster drivers format specific documentation for legal creation options for each format.

-b <band>

Select an input band band containing the DEM data. Bands are numbered from 1. Only a single band can be used. Only the part of the raster within the specified maximum distance around the observer point is processed.

-a_nodata <value>

The value to be set for the cells in the output raster that has no data.

-ox <value>

The X position of the observer (in SRS units).

-oy <value>

The Y position of the observer (in SRS units).

-oz <value>

The height of the observer above the DEM surface in the height unit of the DEM. Default: 2

-tz <value>

The height of the target above the DEM surface in the height unit of the DEM. Default: 0

-md <value>

Maximum distance from observer to compute visibiliy.

-cc <value>

Coefficient to consider the effect of the curvature and refraction. The height of the DEM is corrected according to the following formula:

\[Height_{Corrected}=Height_{DEM}-{CurvCoeff}\frac{{TargetDistance}^2}{SphereDiameter}\]

For atmospheric refraction we can use 0.85714

-iv <value>

Pixel value to set for invisible areas. Default: -1

-ov <value>

Pixel value to set for the cells that fall outside of the range specified by the observer location and the maximum distance. Default: 0

-vv <value>

Pixel value to set for visible areas. Default: 255

C API

Functionality of this utility can be done from C with GDALViewshedGenerate().

Example

Compute the visibility of an elevation raster data source with defaults

../_images/gdal_viewshed.png

A computed visibility for two separate -ox and -oy points on a DEM.

gdal_viewshed -md 500 -ox -10147017 -oy 5108065 source.tif destination.tif
Wang2000

Generating Viewsheds without Using Sightlines. Wang, Jianjun, Robinson, Gary J., and White, Kevin. Photogrammetric Engineering and Remote Sensing. p81. https://www.asprs.org/wp-content/uploads/pers/2000journal/january/2000_jan_87-90.pdf