ggmap Spatial Visualization with ggplot2 Simona Liptáková 460032, Dominik Kovář 459985 > > Obrázok, na ktorom je text, mapa Popis sa automaticky vygeneroval > •a collection of functions to visualize spatial data and models on top of static maps from various online sources (e.g Google Maps, Stamen, Osm, Cloudmade) •plot maps from ggmap, and then use ggplot2 to plot points and other geoms on top of the map HOW IT WORKS GET_MAP •provides a general approach for quickly obtaining maps from multiple sources •Explore different kind of maps •4 map “sources” to obtain a map raster, and each of these sources has multiple “map types“ •stamen: maptype < - c(“terrain”, “toner”, “watercolor”) •google: maptype < - c(“roadmap”, “terrain”, “satellite”, “hybrid”) Obrázok, na ktorom je text, mapa Popis sa automaticky vygeneroval MAPPING SEATTLE CRIME library(ggmap) library(dplyr) library(ggplot2) # GET SEATTLE CRIME DATA download.file("https://vrzkj25a871bpq7t1ugcgmn9-wpengine.netdna-ssl.com/wp-content/uploads/2015/01/ seattle_crime_2010_to_2014_REDUCED.txt.zip", destfile="seattle_crime_2010_to_2014_REDUCED.txt.zip") # UNZIP THE SF CRIME DATA FILE unzip("seattle_crime_2010_to_2014_REDUCED.txt.zip") # READ CRIME DATA INTO AN R DATAFRAME df.seattle_crime <- read.csv("seattle_crime_2010_to_2014_REDUCED.txt") # SEATTLE GGMAP map.seattle_city <- qmap("seattle", zoom = 11, source="stamen", maptype="toner",darken = c(.3,"#BBBBBB")) map.seattle_city # CREATE SCATTERPLOT ggplot() + geom_point(data=df.seattle_crime, aes(x=Longitude, y=Latitude)) # ADD TRANSPARENCY AND COLOR map.seattle_city + geom_point(data=df.seattle_crime, aes(x=Longitude, y=Latitude), color="dark green", alpha=.03, size=1.1) REFERENCES •How to plot basic maps with ggmap. (n.d.) In R-bloggers. Stiahnuté dňa 7.12.2018 z https://www.r-bloggers.com/how-to-plot-basic-maps-with-ggmap/ •Kahle, D., & Wickham, H. (2013). Ggmap: Spatial Visualization with ggplot2 [Online]. R Journal, 5(1), 144-161. http://stat405.had.co.nz/ggmap.pdf • •Mapping Seattle crime. (n.d.) In Sharp Sight. Stiahnuté dňa 7.12.2018 z https://www.sharpsightlabs.com/blog/mapping-seattle-crime/ •Ggmap quickstart. (n.d). Stiahnuté dňa 7.12.2018 z https://www.nceas.ucsb.edu/~frazier/RSpatialGuides/ggmap/ggmapCheatsheet.pdf •