base_map: Create background map

View source: R/base_map.R

base_mapR 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 = "toner-lite",
  zoom = NULL,
  ...
)

Arguments

bbox

Bounding box vector.

bg_crs

EPSG code or st_crs object for the returned map.

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 bg_map is not specified. An integer value, 5 - 15, with higher numbers providing more detail. If not provided, a zoom level is autoscaled based on bbox parameters.

...

Additional arguments to be passed to ggmap::get_stamenmap

Details

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.

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))


# Default zoom map with terrain maptype.
y <- base_map(bound_box, maptype = 'terrain')


SWMPrExtension documentation built on April 21, 2023, 1:14 a.m.