Can be used to make multiple layers or multiple maps based on a grouping variable.
Usage
layer_grouped(
data,
mapping = NULL,
groupname_col = "group",
label_col = "name",
geom = "sf",
basemap = FALSE,
palette = NULL,
aesthetics = "fill",
...
)Arguments
- data
Character string (e.g. url, file path, or name of data from package) for a spatial data or a
sf,sfc, orbboxobject with geometry overlapping the location. If data isNULL, all unnamed parameters are passed tosfext::read_sf_ext()with a bbox based on location. If data is notNULLand not a data.frame, url, file path, or bbox, conversion to a sf object will still always be attempted withsfext::as_sf().- mapping
Set of aesthetic mappings created by
aes(). If specified andinherit.aes = TRUE(the default), it is combined with the default mapping at the top level of the plot. You must supplymappingif there is no plot mapping.- groupname_col
Group column name. Defaults to "group".
- label_col
Column name or id for a column with the text or labels to pass to any text geom.
- geom
A character string indicating which ggplot2 geom to use, Default: 'sf'. Options include "sf" (
ggplot2::geom_sf()), "icon" (layer_icon()), "markers" (layer_markers()), "sf_text" (ggplot2::geom_sf_text()), and "sf_label" (ggplot2::geom_sf_label()). See details for a full list.- basemap
Either a logical vector or ggplot object.
If logical and
TRUE, add x toggplot2::ggplot(). IfFALSE, return x as is.If a ggplot, add x to basemap object.
If a ggproto object (or list that contains a ggproto object), add x and basemap object to
ggplot2::ggplot().- palette
Name of palette as a string. Must be on the form packagename::palettename.
- aesthetics
Aesthetic to map to groupname_col. Defaults to "fill"; also supports "color" or c("fill", "color").
- ...
Additional parameters passed to
layer_location_data()
