get_map | R Documentation |
get_map()
is a smart wrapper that queries the Google Maps,
OpenStreetMap, and Stadia Maps servers for a map.
get_map(
location = c(lon = -95.3632715, lat = 29.7632836),
zoom = "auto",
scale = "auto",
maptype = c(GOOGLE_VALID_MAP_TYPES, STADIA_VALID_MAP_TYPES),
source = c("google", "osm", "stadia"),
force = ifelse(source == "google", TRUE, FALSE),
messaging = FALSE,
urlonly = FALSE,
filename = NULL,
crop = TRUE,
color = c("color", "bw"),
language = "en-EN",
...
)
location |
an address, longitude/latitude pair (in that order), or left/bottom/right/top bounding box |
zoom |
map zoom, an integer from 3 (continent) to 21 (building), default value 10 (city). openstreetmaps limits a zoom of 18, and the limit on Stadia Maps depends on the maptype. "auto" automatically determines the zoom for bounding box specifications, and is defaulted to 10 with center/zoom specifications. maps of the whole world currently not supported. |
scale |
scale argument of |
maptype |
character string providing map theme. options available are "terrain", "terrain-background", "satellite", "roadmap", and "hybrid" (Google Maps), "stamen_terrain", "stamen_toner", "stamen_toner_lite", "stamen_watercolor", "stamen_terrain_background", "stamen_toner_background", "stamen_terrain_lines", "stamen_terrain_labels", "stamen_toner_lines", "stamen_toner_labels" (Stadia Maps) |
source |
Google Maps ("google"), OpenStreetMap ("osm"), Stadia Maps ("stadia") |
force |
force new map (don't use archived version) |
messaging |
turn messaging on/off |
urlonly |
return url only |
filename |
destination file for download (file extension added according
to format). Default |
crop |
(Stadia and cloudmade maps) crop tiles to bounding box |
color |
color ("color") or black-and-white ("bw") |
language |
language for google maps |
... |
... |
a ggmap object (a classed raster object with a bounding box attribute)
David Kahle david@kahle.io
ggmap()
## Not run: some requires Google API key, see ?register_google
## basic usage
########################################
# lon-lat vectors automatically use google:
(map <- get_map(c(-97.14667, 31.5493)))
str(map)
ggmap(map)
# bounding boxes default to Stadia Maps
(map <- get_map(c(left = -97.1268, bottom = 31.536245, right = -97.099334, top = 31.559652)))
ggmap(map)
# characters default to google
(map <- get_map("orlando, florida"))
ggmap(map)
## basic usage
########################################
(map <- get_map(maptype = "roadmap"))
(map <- get_map(source = "osm"))
(map <- get_map(source = "stadia", maptype = "stamen_watercolor"))
map <- get_map(location = "texas", zoom = 6, source = "stadia")
ggmap(map, fullpage = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.