fov_mask {viewscape} | R Documentation |
The fov_mask function is designed to subset a viewshed based on its viewpoint and the field of view
fov_mask(viewshed, fov)
viewshed |
viewshed object, generated by compute_viewshed() |
fov |
Vector, specifying the field of view with two angles in degree (e.g. c(10,100)) for masking a viewshed based on its viewpoints. See details. |
For defining the field of view ('fov'), angles range from 0 to 360 degrees, with 0 inclusive and 360 exclusive. The initial angle must be smaller than the terminal angle in the sequence c(a,b) (a < b). To capture the northeast quadrant of a viewshed, one would use c(0,90), while the eastern quadrant would be delineated by c(45,315) as shown below:
135 | 90 | 45 |
180 | v | 0 |
225 | 270 | 315 |
Here, 'v' represents the viewpoint, with angles measured counterclockwise from due north.
viewshed object
# Load a viewpoint
test_viewpoint <- sf::read_sf(system.file("test_viewpoint.shp", package = "viewscape"))
# load dsm raster
dsm <- terra::rast(system.file("test_dsm.tif", package ="viewscape"))
# Compute viewshed
viewshed <- viewscape::compute_viewshed(dsm,
viewpoints = test_viewpoint,
offset_viewpoint = 6)
# subset viewshed using the field of view
out <- viewscape::fov_mask(viewshed, c(40,160))