Created
August 11, 2015 21:26
-
-
Save pepijn-devries/401aae570710af707691 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Download nice-looking map-tiles for the relevant location | |
photo_map <- openmap(upperLeft = c(max(file_info$lat, na.rm = T) + 0.2, min(file_info$lon, na.rm = T) - 0.2), | |
lowerRight = c(min(file_info$lat, na.rm = T) - 0.2, max(file_info$lon, na.rm = T) + 0.2), | |
type = "stamen-watercolor") | |
# we need to turn our coordinates into an sp object in order to | |
# properly project the points onto the map. | |
photo_points <- SpatialPoints(na.omit(file_info[,c("lon", "lat")]), | |
CRS("+proj=longlat +ellps=WGS84 +datum=WGS84")) | |
# transform the lon lat coordinates to the same projection as the map tiles. | |
photo_points <- spTransform(photo_points, photo_map$tiles[[1]]$projection) | |
# plot the map and locations of the pictures | |
png("jpg_geotags01.png", photo_map$tiles[[1]]$yres/3, photo_map$tiles[[1]]$xres/3, type = "cairo") | |
plot(photo_map) | |
plot(photo_points, add = T, pch = 19, cex = 0.8) | |
plot(photo_points, add = T, pch = 19, cex = 0.5, col = rainbow(length(photo_points))) | |
dev.off() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment