Extract metadata of photographs from a given root folder. The function was designed to deal with the metadata from photos taken with a DSRL camera equipped with GPS and compass (e.g. Canon 7D Mark II, Nikon D7200)

getPhotoMetadata(
  ROOTfolderpath,
  extension = ".jpg",
  ignore = NULL,
  timezone = NULL,
  export = NULL,
  data_photoid = NULL
)

Arguments

ROOTfolderpath

full path to folder where all photos are (without a final slash). E.g. '/Users/you/Desktop'

extension

extension of photo files, either a single string or a vector with more than one extension. Currently it takes c('.JPG', '.JPEG', '.TIFF', '.PNG', '.jpg', '.jpeg', '.tiff', '.png')

ignore

Should any photograph be skipped, enter a string or a vector of strings that match the file name of such files E.g. if you want to ignore all photos with file names containing 'DCIM_', then input ignore = "DCIM". If you want all file names with 'DCIM_' and 'edited' to be ignored, then input ignore = c("DCIM", "edited").

timezone

string. Add the correct timezone where the drone videos were taken, as per the R base notation (for additional information, see help(timezomes)). Should this argument be left empty, the time zone will be assumed to be the same as the computer system.

export

full path AND .csv filename to where the metadata should be exported to. E.g. export = '/Users/you/Database/camera_metadata.csv'. Should the metadata not be exported, export=NA. When exporting filenames, note that Microsoft Excel uses hh:mm as the default time format. Then, change column format to "mm/dd/yy hh:mm:ss" to reatain the seconds.

data_photoid

A 2 column dataframe in which the first column contains the image file name (basename) and the second columns contains the respective ID for each photo.

Value

a data frame with the metadata of photographs videos: folder path, file name, datetime_GPS_UTC, datetime_local, camera.CreateDate, TimeZone, TimeZoneCity, DaylightSavings, CanonModelID, GPSLatitudeRef, GPSLongitudeRef, GPSMapDatum, GPSAltitude, direction.angle, direction.angle.ref,GPSLatitudeGPSLongitude, latitude, longitude

Author

Mauricio Cantor

Examples

if (FALSE) myPhotoMetadata <- getPhotoMetadata(ROOTfolderpath = '/Desktop/you/data', extension='.JPG', ignore = NA, timezone='America/Sao_Paulo', export = NA)