Downloads a Stamen Maps or Google Maps base layer map using get_map.
download_basemap(
x,
verbose = TRUE,
zoom,
alpha = 1,
source = "stamen",
maptype = "terrain",
...
)
An object of class ppi
.
Logical, whether to print information to console.
Zoom level (optional), see get_map. An integer from 3 (continent) to 21 (building). By default the zoom level matching the ppi extent is selected automatically.
Transparency of the basemap (0-1).
String identifying which map service should be used: "stamen" or "google".
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", "watercolor". For Google Maps: "terrain", "satellite", "roadmap", "hybrid"
Arguments to pass to get_map function.
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.
To use maptype
, install the development version of ggmap (>3.0.0) with
devtools::install_github("dkahle/ggmap")
.
# load an example scan:
data(example_scan)
# print summary info for the scan:
example_scan
#> Polar scan (class scan)
#>
#> parameters: DBZH VRADH RHOHV ZDR PHIDP
#> elevation angle: 0.5 deg
#> dims: 480 bins x 360 rays
# make ppi for the scan
ppi <- project_as_ppi(example_scan)
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
# \dontrun{
# grab 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 reflectivity quantity of the ppi onto the basemap:
map(ppi, map = basemap, param = "DBZH")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
# increase the transparancy 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 = "DBZH")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
# download a different type of basemap, e.g. a gray-scale image:
# see get_map() in ggmap library for full documentation of 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 the radial velocities onto the line image:
map(ppi, map = basemap, param = "VRADH")
#> Warning: CRS object has comment, which is lost in output; in tests, see
#> https://cran.r-project.org/web/packages/sp/vignettes/CRS_warnings.html
# }