Check if point 1 is visible from point 2 given a certain elevation model
Arguments
- r
A DEM raster
- xy1
A vector/matrix with X and Y coordinates for Point 1
- xy2
A vector/matrix with X and Y coordinates for Point 2
- h1
A numeric giving the extra height offset for Point 1
- h2
A numeric giving the extra height offset for Point 2
- reso
The minimal resolution of the DEM raster. It is calculated in
viewshed
and passed along.- plot
Plot the process? Default is
FALSE
- ...
Additional arguments passed to the raster plot
See also
Other Viewshed Analysis:
interpol_view()
,
plot_viewshed()
,
rasterprofile()
,
viewTo()
,
viewshed()
Examples
if (FALSE) {
library(raster)
library(sf)
matrix <- matrix(abs(sin(1:100))*10, nrow=10, byrow = TRUE)
r1 <- raster(matrix)
shape <- st_as_sf(as(extent(r1), "SpatialPolygons"))
locs = st_sample(shape, 10, type = "random");
mw <- methods::as(methods::as(r1, "SpatialPixelsDataFrame"), "SpatialPolygons")
sample_xy <- st_coordinates(st_centroid(st_as_sf(mw)))
Pt1 <- 3
for (i in 1:nrow(sample_xy)) {
cansee(r1,
xy1 = st_coordinates(locs)[Pt1,],
xy2 = sample_xy[i,],
h1 = 3,
h2 = 1.5,
reso = min(res(r1)),
plot=TRUE)
invisible(readline(prompt="Press [enter] to continue"))
}
}