'\" t .\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "GDAL-RASTER-VIEWSHED" "1" "May 06, 2025" "" "GDAL" .SH NAME gdal-raster-viewshed \- Compute the viewshed of a raster dataset. .sp Added in version 3.11. .SH SYNOPSIS .INDENT 0.0 .INDENT 3.5 .sp .EX Usage: gdal raster viewshed [OPTIONS] Compute the viewshed of a raster dataset. Positional arguments: \-i, \-\-input Input raster dataset [required] \-o, \-\-output Output raster dataset (created by algorithm) [required] Common Options: \-h, \-\-help Display help message and exit \-\-json\-usage Display usage as JSON document and exit \-\-config = Configuration option [may be repeated] \-\-progress Display progress bar Options: \-f, \-\-of, \-\-format, \-\-output\-format Output format \-\-co, \-\-creation\-option = Creation option [may be repeated] \-\-overwrite Whether overwriting existing output is allowed \-p, \-\-pos, \-\-position or Observer position [2..3 values] [required] \-\-target\-height Height of the target above the DEM surface in the height unit of the DEM. (default: 0) \-\-mode Sets what information the output contains.. MODE=normal|DEM|ground|cumulative (default: normal) \-\-max\-distance Maximum distance from observer to compute visibility. It is also used to clamp the extent of the output raster. \-\-curvature\-coefficient Coefficient to consider the effect of the curvature and refraction. \-b, \-\-band Input band (1\-based index) (default: 1) \-\-visible\-value Pixel value to set for visible areas (default: 255) \-\-invisible\-value Pixel value to set for invisible areas (default: 0) \-\-out\-of\-range\-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) \-\-dst\-nodata The value to be set for the cells in the output raster that have no data. \-\-observer\-spacing Cell Spacing between observers (default: 10) \-j, \-\-num\-threads Number of jobs (or ALL_CPUS) (default: 3) Advanced Options: \-\-oo, \-\-open\-option = Open options [may be repeated] \-\-if, \-\-input\-format Input formats [may be repeated] .EE .UNINDENT .UNINDENT .SH DESCRIPTION .sp \fBgdal raster viewshed\fP creates a binary visibility raster from one band of the input raster elevation model (DEM). The output raster will be of type Byte. Using the \fBDEM\fP or \fBground\fP values of \fI\%\-\-mode\fP can also create a minimum visible height raster of type Float64. .sp It uses the method defined in \fI\%[Wang2000]\fP for a user defined point. .SS Standard options .INDENT 0.0 .TP .B \-f, \-\-of, \-\-format, \-\-output\-format Which output raster format to use. Allowed values may be given by \fBgdal \-\-formats | grep raster | grep + | sort\fP .UNINDENT .INDENT 0.0 .TP .B \-\-co = 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. .sp May be repeated. .sp 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 \fI\%\-\-formats\fP command line option but the documentation for the format is the definitive source of information on driver creation options. See \fI\%Raster drivers\fP format specific documentation for legal creation options for each format. .UNINDENT .INDENT 0.0 .TP .B \-\-overwrite Allow program to overwrite existing target file or dataset. Otherwise, by default, \fBgdal\fP errors out if the target file or dataset already exists. .UNINDENT .INDENT 0.0 .TP .B \-b, \-\-band Select an input 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. .UNINDENT .INDENT 0.0 .TP .B \-\-dst\-nodata The value to be set for the cells in the output raster that have no data. .sp \fBNOTE:\fP .INDENT 7.0 .INDENT 3.5 Currently, no special processing of input cells at a nodata value is done (which may result in erroneous results). .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-p, \-\-pos, \-\-position or The X,Y or X,Y,H(Height) position of the observer (in SRS units for X and Y, and in the height unit of the DEM for H). If the coordinate is outside of the raster, all space between the observer and the raster is assumed not to occlude visibility of the raster. (Not supported in cumulative mode.) If H is not specified, it defaults to 2. .UNINDENT .INDENT 0.0 .TP .B \-\-target\-height The height of the target above the DEM surface in the height unit of the DEM. Default: 0 .UNINDENT .INDENT 0.0 .TP .B \-\-max\-distance Maximum distance from observer to compute visibility. It is also used to clamp the extent of the output raster. (Not supported in cumulative mode) .UNINDENT .INDENT 0.0 .TP .B \-\-curvature\-coefficient Coefficient to consider the effect of the curvature and refraction. When calculating visibility between two points (i.e. Line Of Sight or Viewshed), The magnitude of this effect varies with atmospheric conditions and depends on the wavelength. .sp Different applications for calculating visibility use different interchangeable notation to describe this phenomena: Refraction Coefficient, Curvature Coefficient, and Sphere Diameter Factor. gdal_viewshed uses the Curvature Coefficient notation. .sp .ce {CurvCoeff}=1\-{RefractionCoeff} .ce 0 .sp Changes in air density curve the light downward causing an observer to see further and the earth to appear less curved, as if the sphere (earth) diameter is larger then it actually is. The ratio between that imaginary sphere diameter and the actual sphere diameter is given by the formula: .sp .ce {SphereDiameterFactor}=1/{CurvCoeff}=1/(1\-{RefractionCoeff}) .ce 0 .sp For visible light, the standard atmospheric refraction coefficient that is generally used is 1/7. Thus the default value (since GDAL 3.4) for CurvCoeff that gdal_viewshed uses is 0.85714 (=~ 1\-1/7) for Earth CRS. Starting with GDAL 3.6, for non\-Earth CRS (those whole semi\-major axis differs by more than 5% with the one of WGS 84), CurvCoeff default value is 1.0, to account for the no refraction use case. .sp The height of the DEM is corrected according to the following formula: .sp .ce Height_{Corrected}=Height_{DEM}\-{CurvCoeff}\efrac{{TargetDistance}^2}{SphereDiameter} .ce 0 .sp Typical coefficient values are given in the table below (use Curvature Coeff value for the cc option) .TS box center; l|l|l|l. T{ Use Case T} T{ Refraction Coeff T} T{ \fBCurvature Coeff\fP T} T{ Sphere Diameter Factor T} _ T{ No Refraction T} T{ 0 T} T{ 1 T} T{ 1 T} _ T{ Visible Light T} T{ 1/7 T} T{ 6/7 (=~0.85714) T} T{ 7/6 (=~1.1666) T} _ T{ Radio Waves T} T{ 0.25 ~ 0.325 T} T{ 0.75 ~ 0.675 T} T{ 1.33 ~ 1.48 T} _ T{ Flat Earth T} T{ 1 T} T{ 0 T} T{ inf T} .TE .UNINDENT .INDENT 0.0 .TP .B \-\-invisible\-value Pixel value to set for invisible areas. (Not supported in cumulative mode) Default: 0 .UNINDENT .INDENT 0.0 .TP .B \-\-out\-of\-range\-value Pixel value to set for the cells that fall outside of the range specified by the observer location and the maximum distance. (Not supported in cumulative mode) Default: 0 .UNINDENT .INDENT 0.0 .TP .B \-\-visible\-value Pixel value to set for visible areas. (Not supported in cumulative mode) Default: 255 .UNINDENT .INDENT 0.0 .TP .B \-\-mode normal|DEM|ground|cumulative Sets what information the output contains. .INDENT 7.0 .IP \(bu 2 \fBnormal\fP (the default) returns a raster of type Byte containing visible locations. .IP \(bu 2 \fBDEM\fP and \fBground\fP return a raster of type Float64 containing the minimum target height for the target to be visible from the DEM surface or ground level respectively. That is to say, if the minimum target height for the target to be visible at a point is \fBh\fP and the value of the input raster at that point is \fBE\fP, for \fBDEM\fP, \fBE + h\fP will be the output value. For \fBground\fP, \fBh\fP will be output value. Options \fB\-\-target\-height\fP, \fB\-\-invisible\-value\fP and \fB\-\-visible\-value\fP will be ignored. .IP \(bu 2 \fBcumulative\fP creates an eight bit raster the same size as the input raster where each cell represents the relative observability from a grid of observer points. See the \fI\%\-\-observer\-spacing\fP option. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \-\-observer\-spacing Cell spacing between observers (only supported in cumulative mode). Default: 10 .UNINDENT .INDENT 0.0 .TP .B \-j, \-\-num\-threads Number of jobs to run at once. (only supported in cumulative mode). Default: 3 .UNINDENT .SH EXAMPLES .SS Example 1 .sp Screenshot of 2 combined viewshed analysis, with the yellow pixels showing the area that is visible from the both observation locations (the green dots), while the small green area is only visible from one location. .INDENT 0.0 .INDENT 2.5 [image] .UNINDENT .UNINDENT .sp Create a viewshed raster with a radius of 500 for a person standing at location (\-10147017, 5108065). .INDENT 0.0 .INDENT 3.5 .sp .EX gdal raster viewshed \-\-max\-distance=500 \-\-pos=\-10147017,5108065 source.tif destination.tif .EE .UNINDENT .UNINDENT .SH AUTHOR Even Rouault .SH COPYRIGHT 1998-2025 .\" Generated by docutils manpage writer. .