Examples for 'ggmap::get_googlemap'


Get a Google Map.

Aliases: get_googlemap

Keywords:

### ** Examples


## Not run: 
##D  requires Google API key, see ?register_google
##D 
##D ## basic usage
##D ########################################
##D 
##D (map <- get_googlemap(c(-97.14667, 31.5493)))
##D ggmap(map)
##D 
##D # plotting based on a colloquial name
##D # this requires a geocode() call, and needs that API
##D get_googlemap("waco, texas") %>% ggmap()
##D 
##D # different maptypes are available
##D get_googlemap("waco, texas", maptype = "satellite") %>% ggmap()
##D get_googlemap("waco, texas", maptype = "hybrid") %>% ggmap()
##D 
##D # you can get the url as follows
##D # see ?register_google if you want the key printed
##D get_googlemap(urlonly = TRUE)
##D 
##D 
##D ## other usage
##D ########################################
##D 
##D # markers and paths are easy to access
##D d <- function(x=-95.36, y=29.76, n,r,a){
##D   round(data.frame(
##D     lon = jitter(rep(x,n), amount = a),
##D     lat = jitter(rep(y,n), amount = a)
##D   ), digits = r)
##D }
##D df <- d(n=50,r=3,a=.3)
##D map <- get_googlemap(markers = df, path = df, scale = 2)
##D ggmap(map)
##D ggmap(map, extent = "device") +
##D   geom_point(aes(x = lon, y = lat), data = df, size = 3, colour = "black") +
##D   geom_path(aes(x = lon, y = lat), data = df)
##D 
##D gc <- geocode("waco, texas", source = "google")
##D center <- as.numeric(gc)
##D ggmap(get_googlemap(center = center, color = "bw", scale = 2), extent = "device")
##D 
##D # the scale argument can be seen in the following
##D # (make your graphics device as large as possible)
##D ggmap(get_googlemap(center, scale = 1), extent = "panel") # pixelated
##D ggmap(get_googlemap(center, scale = 2), extent = "panel") # fine
##D 
##D # archiving; note that you must meet google's terms for this condition
##D map <- get_googlemap(archiving = TRUE)
##D map <- get_googlemap()
##D map <- get_googlemap()
##D ggmap(map)
##D 
##D 
##D # style
##D map <- get_googlemap(
##D   maptype = "roadmap",
##D   style = c(feature = "all", element = "labels", visibility = "off"),
##D   color = "bw"
##D )
##D ggmap(map)
##D 
##D 
##D 
##D 
## End(Not run)

[Package ggmap version 3.0.0 Index]