Visualizing Geospatial Data in R
Charlotte Wickham
Assistant Professor at Oregon State University
library(ggmap) corvallis <- c(lon = -123.2620, lat = 44.5646)
corvallis_map <- get_map(corvallis, zoom = 13, scale = 1)
Map from URL : http://maps.googleapis.com/maps/api/staticmap?center=44.5646,-123.2
62&zoom=13&size=640x640&scale=1&maptype=terrain&language=en-EN&sensor=false
By default, get_map()
downloads a terrain image from Google maps
corvallis_map <- get_map(corvallis, zoom = 13, maptype = "terrain", source = "google")
?get_map
...
maptype = c("terrain", "terrain-background", "satellite", "roadmap", "hybrid",
"toner", "watercolor", "terrain-labels", "terrain-lines", "toner-2010",
"toner-2011", "toner-background", "toner-hybrid", "toner-labels",
"toner-lines", "toner-lite"),
source = c("google", "osm", "stamen"),
...
corvallis_map <- get_map(corvallis, zoom = 13, maptype = "toner-2010", source = "stamen")
?ggmap
ggmap(ggmap, extent = "panel", base_layer, maprange = FALSE, legend = "right",
padding = 0.02, darken = c(0, "black"), ...)
ggplot(sales, aes(lon, lat)) +
geom_point()
?ggmap
ggmap(ggmap, extent = "panel", base_layer, maprange = FALSE, legend = "right",
padding = 0.02, darken = c(0, "black"), ...)
ggplot() +
geom_point(aes(lon, lat), data = sales)
?ggmap
ggmap(ggmap, extent = "panel", base_layer, maprange = FALSE, legend = "right",
padding = 0.02, darken = c(0, "black"), ...)
ggmap(corvallis_map) +
geom_point(aes(lon, lat), data = sales)
?ggmap
ggmap(ggmap, extent = "panel", base_layer, maprange = FALSE, legend = "right",
padding = 0.02, darken = c(0, "black"), ...)
ggmap(corvallis_map, base_layer = ggplot(sales, aes(lon, lat))) + geom_point() +
facet_wrap(~ condition)
?ggmap
ggmap(ggmap, extent = "panel", base_layer, maprange = FALSE, legend = "right",
padding = 0.02, darken = c(0, "black"), ...)
extent
: How much of the plotting area should the map take up?maprange
: Should the plot limits come from the map limits?Visualizing Geospatial Data in R