base_map | R Documentation |
Create a background map from a bounding box using Stamen Map tiles or a crude vector-based map.
base_map(
bbox,
bg_crs = 4326,
vector_only = FALSE,
maptype = "toner-lite",
zoom = NULL,
...
)
bbox |
Bounding box vector. |
bg_crs |
EPSG code or |
vector_only |
Logical, draw only a simple vector-based map. |
maptype |
Background map type from Stamen Maps (http://maps.stamen.com/); one of c("terrain", "terrain-background", "terrain-labels", "terrain-lines", "toner", "toner-2010", "toner-2011", "toner-background", "toner-hybrid", "toner-labels", "toner-lines", "toner-lite", "watercolor"). |
zoom |
Zoom level for the base map created when |
... |
Additional arguments to be passed to |
A helper, or stand-alone, function to create background map based on
based on raster map tiles retrieved with ggmap::get_stamenmap
. 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.
Returns a ggplot2
object.
Dave Eslinger
# Simple, low-zoom map for testing
bound_box <- c(-77.393, 38.277, -75.553, 39.741)
(x <- base_map(bound_box, zoom = 7))
# Default zoom map with terrain maptype.
y <- base_map(bound_box, maptype = 'terrain')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.