tests/testthat/test_sector_mask.R

testthat::test_that("runs correctly", {

  #Load in DSM
  test_dsm <- terra::rast(system.file("test_dsm.tif",
                                      package ="viewscape"))

  #Load in the viewpoint
  test_viewpoint <- sf::read_sf(system.file("test_viewpoint.shp",
                                            package = "viewscape"))

  #Compute viewshed
  output <- viewscape::compute_viewshed(dsm = test_dsm,
                                        viewpoints = test_viewpoint,
                                        offset_viewpoint = 6,
                                        plot=FALSE)
  test_sector <- viewscape::fov_mask(output, c(40,160))
  testthat::expect_type(test_sector, "S4")
})

Try the viewscape package in your browser

Any scripts or data that you put into this service are public.

viewscape documentation built on April 4, 2025, 1:40 a.m.