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 st_crs object for the returned map.

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

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


[Package SWMPrExtension version 2.2.5.1 Index]