get_google_map | R Documentation |
The functions get_googlemap()
and get_stadia_map()
tries to harmonize the calls to ggmap()
. The objective is
to get interchangeable functions with sensible defaults. For example automatic calculation of the zoom. The function
bbox_lv95()
generates a bbox object compatible with both functions. Before using this function you need to register
your google API key with ggmap::register_google()
. For details consult the documentation of the
Maps Static API and ggmap::get_googlemap()
.
get_google_map(
bbox,
width = 640,
zoom = "auto",
scale = 2,
language = "de-CH",
color = "bw",
style = c(feature = "all", element = "labels", visibility = "off"),
...
)
bbox |
list with item |
width |
of resulting map in pixels. Is divided trough scale to calculate size. |
zoom |
of tile map as Integer or "auto" |
scale |
affects the size of labels. |
language |
character string providing language of map labels (for themes with them) in the format "en-EN". not all languages are supported; for those which aren't the default language is used. |
color |
color or black-and-white. Changed default to "bw" |
style |
character string or named vector to style the map. This is a powerful and complex specification. See Styled Maps in the documentation of the google maps platform |
... |
forwarded to |
a ggmap object (a classed raster object with a bounding box attribute)
library(ggmap)
ggmap::register_google(Sys.getenv("GGMAP_GOOGLE_API_KEY"))
bb <- bbox_lv95(2683141, 1249040, 500) # site Zch_Stamfenbachstrasse
get_google_map(bb) %>% ggmap::ggmap()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.