register_map {cartographer} | R Documentation |
Register a new feature type
Description
This adds a new feature type that can then be used by all the geoms in this
package. If registering from another package, this should occur in the
.onLoad()
hook in the package.
Usage
register_map(
feature_type,
data,
feature_column,
aliases = NULL,
outline = NULL,
lazy = TRUE
)
Arguments
feature_type |
Name of the type. If registering from within a package,
the suggested format is |
data |
A simple feature data frame with the map data, or a function
that returns a data frame. When |
feature_column |
Name of the column of |
aliases |
Optional named character vector or list that maps aliases to values that appear in the feature column. This allows abbreviations or alternative names to be supported. |
outline |
Optional sf geometry containing just the outline of the map,
or a function returning such a geometry. When |
lazy |
When |
Details
Registration supports delayed evaluation (lazy loading). This is particularly useful for larger datasets, so that they are not loaded into memory until they are accessed.
Value
No return value; this updates the global feature registry.
See Also
vignette("registering_maps")
Examples
# register a map of the states of Italy from rnaturalearth using the
# Italian names, and providing an outline of the country
register_map(
"italy",
data = rnaturalearth::ne_states(country = "italy", returnclass = "sf"),
feature_column = "name_it",
outline = rnaturalearth::ne_countries(country = "italy", returnclass = "sf", scale = "large")
)