If you have the location (latitude and longitude) of a gauging station or a rain gauge, it’s nice to make a map for a report or just to confirm your sites are where you think they are.
In R we can link to google maps, extract areas of interest and then use ggplot to add points and annotations. The example below shows how to plot the site of a gauge in north east Victoria; Boggy Creek at Angleside.
Try out different zoom arguments in the ggmap function and different maptypes. Google provides 4 maptypes:
It is also possible to obtain maps from Open Street Map, set source = ‘osm’.
For further examples visit:
- GPS basemaps in R using get_map
- Maps in R: Plotting data points on a map
- ggmap: Spatial Visualization with ggplot2
- Running paths in Amsterdam
library(ggmap) library(gdata) library(dplyr) loc <- c(lon = 146.362, lat = -36.6063 ) my.map <- ggmap(get_map(loc, zoom = 12, source = "google", maptype = 'hybrid')) my.map + geom_point(data = as_data_frame(as.list(loc)), aes(lon, lat), size = 3, color='red') + xlab("") + ylab("") + geom_text(data = as_data_frame(as.list(loc)), aes(lon, lat), label = ' Boggy Creek @ Angleside', color = 'red', size = 4, hjust = 1.05, vjust = -0.7 )