Skip to contents

Calculate and plot visibility for given points in a given area.

Usage

plot_viewshed(r, turbine_locs, h1 = 0, h2 = 0, plot = TRUE, ...)

Arguments

r

The elevation SpatRaster

turbine_locs

Coordinates, SpatialPoint or SimpleFeature Points representing the wind turbines

h1

A single number or numeric vector giving the extra height offsets for the turbine_locs

h2

The height offset for Point 2

plot

Should the result be plotted. Default is TRUE

...

forwarded to terra::plot

Value

A mosaiced SpatRaster, representing the visibility for all turbine_locs

Examples

# \donttest{
library(sf)
library(terra)
#> terra 1.7.78

f <- system.file("ex/elev.tif", package = "terra")
r <- rast(f)
x <- project(r, "EPSG:2169")
shape <- sf::st_as_sf(as.polygons(terra::boundaries(x)))
plot(shape)

st_crs(shape) <- 2169
locs <- st_sample(shape, 10, type = "random")
plot_viewshed(x, locs, h1 = 0, h2 = 0, plot = TRUE)

#> class       : SpatRaster 
#> dimensions  : 108, 74, 1  (nrow, ncol, nlyr)
#> resolution  : 771.9464, 771.9464  (x, y)
#> extent      : 49072.34, 106196.4, 56455.27, 139825.5  (xmin, xmax, ymin, ymax)
#> coord. ref. : Luxembourg 1930 / Gauss (EPSG:2169) 
#> source(s)   : memory
#> varname     : spat_1adf46a079c8_6879_2 
#> name        : viewshed 
#> min value   :        0 
#> max value   :        1 
# }