calc_zoi | R Documentation |
This function takes in a raster with locations of infrastructure and calculates
either (1) a raster representing the Zone of Influence (ZOI) of the neareast feature or (2)
a raster representing the cumulative Zone of Influence of multiple features, or both.
This function takes in a raster with locations or counts of
infrastructure and calculates a raster (or set of rasters, in case there is
more the one value for radius
) representing either of two zone of influence (ZOI)
metrics for type of infrastructure: (1) the ZOI of the neareast feature, (2) the cumulative
ZOI of multiple features, or (3) both ZOI metrics. Zones of influence
are defined by functions that decay with the distance from each
infrastructure and their rate of decay is controlled by the ZOI radius
(radius
), which defines how far the influence of an infrastructure
feature goes. To see more information on each ZOI metric, see
calc_zoi_nearest()
and calc_zoi_cumulative()
.
calc_zoi(
x,
radius = 100,
type = c("circle", "Gauss", "rectangle", "exp_decay", "bartlett", "threshold",
"mfilter")[1],
zoi_metric = c("all", "nearest", "cumulative")[1],
where = c("R", "GRASS")[1],
zeroAsNA = TRUE,
output_type = c("cumulative_zoi", "density")[1],
...
)
x |
The default parameters assume that the input |
radius |
|
type |
|
zoi_metric |
|
output_type |
|
If the calculations are performed in R (where = "R"
),
a RasterLayer
/RasterStack
or SpatRaster object
(according to the input x
map)
with the either the zone of influence of the nearest feature
(if zoi_metric = "nearest"
), the cumulative zone of influence of multiple
features (if zoi_metric = "cumulative"
), or both metrics
(if zoi_metric = "all"
, the default).
If the computation is done in GRASS GIS, the output is the name of
the output raster map(s) within the GRASS GIS location and mapset of the
current session. The user can retrieve these maps to R using
rgrass::read_RAST()
or export them outside GRASS using the
r.out.gdal
module, for instance.
Fore more details on each of the ZOI metrics,
other function parameters, and their specific details, see
calc_zoi_nearest()
and calc_zoi_cumulative()
.
library(terra)
# Load raster data
f <- system.file("raster/sample_area_cabins.tif", package = "oneimpact")
cabins <- terra::rast(f)
#---
# check background values
terra::freq(cabins) ## No zeros, background is NA
# compute both Zoi metrics with Gaussian decay, radius = 1000 m
# since the background is NA, we use zeroAsNA = FALSE
zoi_metrics <- calc_zoi(cabins,
radius = 1000,
type = "Gauss",
zeroAsNA = FALSE)
# check
zoi_metrics
# plot
plot(zoi_metrics)
#-------
# Load raster data
f <- system.file("raster/sample_area_cabins_count.tif", package = "oneimpact")
cabins_count <- terra::rast(f)
# check background values
terra::freq(cabins_count) ## Places with no infrastructure have value zero
# compute both Zoi metrics with linear decay, varying radius from 1000 m to 3000 m
# since the background is zero, we use zeroAsNA = TRUE
zoi_metrics2 <- calc_zoi(cabins_count,
radius = c(1000, 2000, 3000),
type = "bartlett",
zeroAsNA = TRUE,
output_type = "density")
# check
zoi_metrics2
# plot
plot(zoi_metrics2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.