An R package for retrieving and plotting raster map tiles from services like Google Maps and OpenStreetMap using ggplot2.
ggmap is an R package that retrieves raster map tiles from online mapping services like Google Maps, Stadia Maps, and OpenStreetMap, and plots them using the ggplot2 framework. It solves the problem of integrating geographic basemaps into R's data visualization workflow, enabling users to create layered spatial plots with ease.
R users, data scientists, and researchers who need to visualize spatial data or create maps within the R ecosystem, particularly those already familiar with ggplot2.
Developers choose ggmap because it seamlessly extends ggplot2's grammar of graphics to mapping, offering a consistent and powerful API for retrieving map tiles, geocoding, and building complex spatial visualizations without leaving the R environment.
A package for plotting maps in R with ggplot2
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Maps are plotted as ggplot2 layers, enabling full use of geoms, stats, and faceting, as shown in examples with geom_point and facet_wrap for layered visualizations.
Functions like get_stadiamap and get_googlemap fetch raster tiles from Google, Stadia, and OpenStreetMap, simplifying background map addition without manual HTTP requests.
The qmplot() function automatically computes bounding boxes for scatterplots on maps, reducing setup time, as demonstrated in the violent crime data example.
Includes geocode() and revgeocode() for address lookup using Google's API, with mutate_geocode for dplyr-style workflows, enhancing spatial data preparation.
Supports various map types like terrain, satellite, and hybrid from multiple providers, allowing customized aesthetics as shown in the Stadia Maps and Google Maps examples.
Requires API keys for Google Maps and Stadia Maps, with Google necessitating a credit card and potential charges beyond free tiers, adding financial and privacy concerns.
Users must register, enable specific APIs on Google's platform, and manage API keys securely, which the README warns about as an overhead compared to offline tools.
Relies on raster map images, which may not scale well for high-resolution prints or dynamic vector-based visualizations, unlike vector-focused mapping packages.
Google's API policy changes have required updates, as noted in the README, leading to breaking changes for users and potential disruption in geocoding or map retrieval.