Mapping photo locations in Google Maps with RA simple example for visualizing geodata from photos, using R to combine EXIF data and Google Maps. 29 Aug 2016
Geotagging is everywhere; leaving alone security and cyber security issues, we are surrounded with geodata, especially through our multimedia devices and smartphones.
For every photo we take, modern cameras and phones save our geodata as EXIF data inside the file.
What can we do with this data?
There are lots of online applications and offline software with interesting features for showing geodata on a map, for instance, for the creation of georeferenced city issue reporting, holiday travel slideshows, and so on.
The problem, from my point of view, is that most of these solutions are proprietary software, and they require specific applications to be running in order to view the data of the photos on a map. You could export your final work as a movie, for instance, but you would still need a movie player to look at it.
There is a need for a solution to programmatically create usable map visualizations from geotagged photos.
I couldn’t find any software ready for use, so I tried to take a look at different packages from the R statistical programming software, and I tried to combine them together.
Map of the EXIF geodata:
By using the exifr and ggmap libraries, it is possible to read the geodata from a .JPG image and plot a Google Map of the exact position in which the photo was taken. You could then automatically save this map as a standalone .JPG file, for instance.
This will allow to work on an interesting future project, to programmaticaly create “geodata photo slideshows”.
To take a look at the complete source code with a walkthrough and additional examples, please visit the following RPubs link:
The script uses a call to exifr to save geodata from the picture inside a data frame; this data is then used to call get_googlemap and, finally, the ggmap and geom_point ggplot2 commands to plot and annotate the final map.