Downloads a basemap for map.ppi() from Stamen Maps or Google Maps using ggmap::get_map(). To use Google Maps as source, you will have to register with Google, enable billing and provide an API key to ggmap. See the ggmap README for details.

download_basemap(
  x,
  verbose = TRUE,
  zoom,
  alpha = 1,
  source = "stamen",
  maptype = "terrain",
  ...
)

Arguments

x

A ppi object.

verbose

Logical. When TRUE, prints information to console.

zoom

Integer. Optional zoom level from 3 (continent) to 21 (building), see ggmap::get_map(). When undefined, the zoom level will be the one matching the ppi extent.

alpha

Numeric. Transparency of the basemap, value between 0 and 1.

source

Character. Map service to be used: stamen or google.

maptype

Character. Type of basemap to plot. For Stamen Maps: terrain, terrain-background, terrain-labels, terrain-lines, toner, toner-2010, toner-2011, toner-background, toner-hybrid, toner-labels, toner-lines, toner-lite or watercolor. For Google Maps: terrain, satellite, roadmap or hybrid.

...

Arguments to pass to ggmap::get_map().

Value

A ggmap object for map(ppi)

See also

Examples

# Project a scan as a ppi
ppi <- project_as_ppi(example_scan)
# \donttest{
# Create a basemap that matches the extent of the ppi
basemap <- download_basemap(ppi)
#> Downloading zoom = 9 ...
#>  Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.

# Map the radial velocity of the ppi onto the basemap
map(ppi, map = basemap, param = "VRADH")


# Increase the transparency of the basemap
basemap <- download_basemap(ppi, alpha = 0.3)
#> Downloading zoom = 9 ...
#>  Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
map(ppi, map = basemap, param = "VRADH")


# Download a different type of basemap, e.g. a gray-scale image.
# See get_map() in ggmap library for full documentation of the options.
basemap <- download_basemap(ppi, maptype = "toner-lite")
#> Downloading zoom = 9 ...
#>  Map tiles by Stamen Design, under CC BY 3.0. Data by OpenStreetMap, under ODbL.
map(ppi, map = basemap, param = "VRADH")

# }