Returns a mask for an area or areas as a simple feature object.
Usage
layer_mask(
data = NULL,
dist = NULL,
diag_ratio = NULL,
unit = NULL,
asp = NULL,
crs = NULL,
fill = "white",
color = NA,
alpha = 0.5,
mask = NULL,
neatline = FALSE,
...
)Arguments
- data
sf,sfc, orbboxobject. If dist, diag_ratio, and/or asp are provided, data is adjusted to set the boundaries of the mask. If data is not provided,maskis required.- dist
buffer distance in units. Optional.
- diag_ratio
ratio of diagonal distance of area's bounding box used as buffer distance. e.g. if the diagonal distance is 3000 meters and the "diag_ratio = 0.1" a 300 meter will be used. Ignored when
distis provided.- unit
Units for buffer. Supported options include "meter", "foot", "kilometer", and "mile", "nautical mile" Common abbreviations (e.g. "km" instead of "kilometer") are also supported. Distance in units is converted to units matching GDAL units for x; defaults to "meter"
- asp
Aspect ratio of width to height as a numeric value (e.g. 0.33) or character (e.g. "1:3"). If numeric,
get_asp()returns the same value without modification.- crs
Coordinate reference system of bounding box to return
- fill
mask fill color; defaults to "white"
- color
mask edge color; defaults to
NA- alpha
mask alpha/transparency; defaults to 0.5
- mask
A
sforbboxobject to define the edge of the mask.diag_ratio,dist, andaspparameters are ignored if amaskis provided. defaults toNULL- neatline
If TRUE, add
layer_neatlinewithexpand = TRUE; defaults to FALSE.- ...
Additional parameters to pass to
ggplot2::geom_sf()
Value
ggplot2::geom_sf() function.
See also
Other layer:
layer_frame(),
layer_icon(),
layer_location_data(),
layer_markers(),
layer_neatline(),
layer_scaled()