Title: Geospatial Tools for Visibility Analysis
Version: 0.1.0
Description: Provides tools for visibility analysis in geospatial data. It offers functionality to perform isovist calculations, using arbitrary geometries as both viewpoints and occluders.
License: Apache License (≥ 2)
URL: https://cityriverspaces.github.io/visor/, https://github.com/CityRiverSpaces/visor
BugReports: https://github.com/CityRiverSpaces/visor/issues
Imports: sf, sfheaders
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Depends: R (≥ 4.1.0)
Config/testthat/edition: 3
Encoding: UTF-8
RoxygenNote: 7.3.2
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2025-04-03 20:10:49 UTC; claudiuforgaci
Author: Claudiu Forgaci ORCID iD [aut, cre, cph], Francesco Nattino ORCID iD [aut], Netherlands eScience Center [fnd]
Maintainer: Claudiu Forgaci <c.forgaci@tudelft.nl>
Repository: CRAN
Date/Publication: 2025-04-07 16:10:01 UTC

Create a polygon representing an occluder

Description

Create a polygon representing an occluder

Usage

create_occluder(center_x, center_y, length, width)

Arguments

center_x

Center x coordinate

center_y

Center y coordinate

length

Length of the occluder

width

Width of the occluder

Value

object of class sfc_POLYGON

Examples

occluder <- create_occluder(0, 0, 10, 2)

Calculate isovist from one or multiple viewpoints

Description

Isovists are estimated by shooting a set of rays from each viewpoint, and by constructing the envelope of the (partially occluded) rays.

Usage

get_isovist(
  viewpoints,
  occluders = NULL,
  ray_num = 40,
  ray_length = 100,
  remove_holes = TRUE
)

Arguments

viewpoints

object of class sf_POINT or sfc_POINT

occluders

object of class sf, sfc or sfg

ray_num

number of rays per viewpoint. The number of rays per quadrant needs to be a whole number, so ray_num will be rounded to the closest multiple of four

ray_length

length of rays

remove_holes

whether to remove holes from the overall isovist geometry

Value

object of class sfc_POLYGON or sfc_MULTIPOLYGON

Examples

# Define viewpoints and occluder geometries
viewpoints <- sf::st_sfc(
  sf::st_point(c(-1, 1)),
  sf::st_point(c(0, 0)),
  sf::st_point(c(1, -1))
)
occluder1 <- sf::st_polygon(list(sf::st_linestring(
  cbind(c(-1, -1, -0.9, -0.9, -1),
        c(-1, -0.9, -0.9, -1, -1))
)))
occluder2 <- sf::st_polygon(list(sf::st_linestring(
  cbind(c(0.4, 0.4, 0.6, 0.6, 0.4),
        c(0.5, 0.7, 0.7, 0.5, 0.5))
)))
occluders <- sf::st_sfc(occluder1, occluder2)

# Calculare isovist based on 40 rays (default)
get_isovist(viewpoints, occluders, ray_length = 1.5)

# Increase number of rays to get higher resolution
get_isovist(viewpoints, occluders, ray_num = 400, ray_length = 1.5)

Construct isovist from (partially occluded) rays

Description

Construct isovist from (partially occluded) rays

Usage

get_isovists(rays)

Arguments

rays

object of class sf, including the "isovist_id" attribute

Value

object of class sfc_POLYGON


Get rays from the viewpoints within a maximum isovist

Description

Get rays from the viewpoints within a maximum isovist

Usage

get_rays(viewpoints, ray_num = 40, ray_length = 100)

Arguments

viewpoints

object of class sf_POINT or sfc_POINT

ray_num

number of rays. The number of rays per quadrant needs to be a whole number, so ray_num will be rounded to the closest multiple of four

ray_length

length of rays

Value

object of class sf_LINESTRING


Get viewpoints from an arbitrary geometry

Description

Generate a discrete set of points on the given geometry. If the geometry is a (MULTI)POLYGON, points are generated on its boundary.

Usage

get_viewpoints(x, density = 1/50)

Arguments

x

object of class sf, sfc or sfg

density

number of points per distance unit

Value

object of class sfc_POINT

Examples

line <- sf::st_linestring(cbind(c(-1, 1), c(0, 0)))
get_viewpoints(line, density = 5)


Merge the viewpoint isovists

Description

Merge the viewpoint isovists

Usage

merge_isovists(isovists, remove_holes = TRUE)

Arguments

isovists

object of class sf, sfc or sfg

remove_holes

whether to remove holes from the overall isovist geometry

Value

object of class sfc_POLYGON or sfc_MULTIPOLYGON


Determine the non-occluded segments of the rays

Description

Determine the non-occluded segments of the rays

Usage

occlude_rays(rays, occluders = NULL)

Arguments

rays

object of class sf_LINESTRING

occluders

object of class sf, sfc or sfg

Value

object of class sf_LINESTRING