Created
January 20, 2016 12:24
-
-
Save pepijn-devries/e1b83bc7a439479d1918 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
# for each file obtain the EXIF codes and extract the coordinates | |
GPStags <- apply(array(file_info$file.name), 1, function(x) { | |
EXIF_code <- NULL | |
try (EXIF_code <- attr(GDALinfo(x), "mdata"), silent = T) | |
if (is.null(EXIF_code)) return(data.frame(lon = NA, lat = NA, dateTime = NA)) else return(get_EXIF_coordinate(EXIF_code)) | |
}) | |
#bind the results: | |
GPStags <- do.call(rbind, GPStags) | |
# store in the data.frame | |
file_info <- cbind(file.name = file_info$file.name , GPStags) | |
# select only rows that hold location data: | |
file_sub <- subset(file_info, !is.na(lon)) | |
# clean up after us | |
rm(GPStags) | |
# hours past midnight (2+ is for converting UTC to CET): | |
file_sub$hours <- 2 + (as.numeric(file_sub$dateTime) %% (60*60*24))/(60*60) | |
# creat palette for the hours after midnight: | |
pal <- colorNumeric("Spectral", file_sub$hours) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment