annotation_map_tile {ggspatial} | R Documentation |
Add background OSM tiles
Description
Uses rosm::osm.image()
to add background tiles. If you are publishing
a map using these tiles, make sure to use the proper attribution
(e.g., "Copyright OpenStreetMap contributors" when using an
OpenStreetMap-based tile set).
Usage
annotation_map_tile(
type = "osm",
zoom = NULL,
zoomin = -2,
forcedownload = FALSE,
cachedir = NULL,
progress = c("text", "none"),
quiet = TRUE,
interpolate = TRUE,
data = NULL,
mapping = NULL,
alpha = 1
)
GeomMapTile
Arguments
type |
The map type (one of that returned by rosm::osm.types) |
zoom |
The zoom level (overrides zoomin) |
zoomin |
Delta on default zoom. The default value is designed
to download fewer tiles than you probably want. Use |
forcedownload |
Re-download cached tiles? |
cachedir |
Specify cache directory |
progress |
Use |
quiet |
Use |
interpolate |
Passed to |
data , mapping |
Specify data and mapping to use this geom with facets |
alpha |
Use to make this layer semi-transparent |
Format
An object of class GeomMapTile
(inherits from Geom
, ggproto
, gg
) of length 5.
Value
A ggplot2 layer
Examples
library(ggplot2)
load_longlake_data(which = "longlake_waterdf")
ggplot() +
annotation_map_tile(zoom = 13, cachedir = system.file("rosm.cache", package = "ggspatial")) +
geom_sf(data = longlake_waterdf, fill = NA, col = "grey50")