base_map {SWMPrExtension} | R Documentation |
Create background map
Description
Create a background map from a bounding box using Stamen Map tiles or a crude vector-based map.
Usage
base_map(
bbox,
bg_crs = 4326,
vector_only = FALSE,
maptype = "stamen_toner_lite",
zoom = NULL,
...
)
Arguments
bbox |
Bounding box vector. |
bg_crs |
EPSG code or |
vector_only |
Logical, draw only a simple vector-based map. |
maptype |
Background map type from Stadia Maps (formerly Stamen) (https://docs.stadiamaps.com/); one of c("stamen_terrain", "stamen_toner", "stamen_toner_lite", "stamen_watercolor", "alidade_smooth", "alidade_smooth_dark", "outdoors", "stamen_terrain_background", "stamen_toner_background", "stamen_terrain_labels", "stamen_terrain_lines", "stamen_toner_labels", "stamen_toner_lines"). |
zoom |
Zoom level for the base map created when |
... |
Additional arguments to be passed to |
Details
A helper, or stand-alone, function to create background map based on
based on raster map tiles retrieved with ggmap::get_stadiamap
. If
ggmap
is unavailable, the function creates a basic map using
county-level polygon files. This map is fairly crude and should be
considered a placeholder.
Value
Returns a ggplot2
object.
Author(s)
Dave Eslinger
Examples
#Simple, low-zoom map for testing
bound_box <- c(-77.393, 38.277, -75.553, 39.741)
(x <- base_map(bound_box, zoom = 7, maptype = 'stamen_toner_lite'))
# Default zoom map with terrain maptype.
y <- base_map(bound_box, maptype = 'stamen_terrain')