View source: R/fire_exp_map_class.R
fire_exp_map_class | R Documentation |
fire_exp_map_class()
produces a standardized map by
classifying exposure into predetermined exposure classes.
fire_exp_map_class(
exposure,
aoi,
classify = c("local", "landscape", "custom"),
class_breaks,
zoom_level,
title = "Classified Exposure"
)
exposure |
SpatRaster (e.g. from |
aoi |
(Optional) SpatVector of an area of interest to mask exposure |
classify |
character, either |
class_breaks |
vector of numeric values between 0-1 of the upper limits
of each custom class. Ignored unless |
zoom_level |
(Optional) numeric, set the zoom level for the basemap based on the extent of your data if defaults are not appropriate. See details. Defaults if:
|
title |
(Optional) String. A custom title for the plot. The default
is |
This function returns a standardized map with basic cartographic elements.
The plot is returned as a ggplot object which can be exported/saved to multiple image file formats.
This function visualizes the outputs from fire_exp()
with classes.
Classes can be chosen from the pre-set "local"
and "landscape"
options,
or customized. To use a custom classification scheme, it should be defined
with a list of numeric vectors defining the upper limits of the breaks. A
Nil class is added automatically for exposure values of exactly zero.
Local classification breaks are predefined as c(0.15, 0.3, 0.45, 1)
:
Nil (0)
0 - 0.15
0.15 - 0.3
0.3 - 0.45
0.45 - 1
Landscape classification breaks are predefined as c(0.2, 0.4, 0.6, 0.8, 1)
:
Nil (0)
0 - 0.2
0.2 - 0.4
0.4 - 0.6
0.6 - 0.8
0.8 - 1
This function dynamically pulls map tiles for a base map. The inputs are projected to WGS 84/Pseudo-Mercator (EPSG:3857) to align them with the map tiles.
The map tile zoom level may need to be adjusted. If the base map is blurry, increase the zoom level. Higher zoom levels will slow down the function, so only increase if necessary. Reference the OpenStreetMap Wiki for more information on zoom levels.
a standardized map is returned as a ggplot object
fire_exp_map_class()
# read example hazard data
hazard_file_path <- "extdata/hazard.tif"
hazard <- terra::rast(system.file(hazard_file_path, package = "fireexposuR"))
# read example area of interest geometry
geom_file_path <- "extdata/polygon_geometry.csv"
geom <- read.csv(system.file(geom_file_path, package = "fireexposuR"))
# generate example area of interest polygon with geometry
aoi <- terra::vect(as.matrix(geom), "polygons", crs = hazard)
# compute exposure
exposure <- fire_exp(hazard)
fire_exp_map_class(exposure, aoi, classify = "local")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.