Free Access Week - Data Engineering + BI
Data Engineering and BI courses are free this week!
Free Access Week - Jun 2-8

plotKML (version 0.5-4)

getWikiMedia.ImageInfo: Gets EXIF information

Description

getWikiMedia.ImageInfo function fetches the EXIF (Exchangeable image file format) data via the http://www.mediawiki.org/wiki/API{Wikimedia API} for any donated image. The resulting EXIF data (named list) can then be further used to construct an object of class "SpatialPhotoOverlay", which can be parsed to KML.

Usage

getWikiMedia.ImageInfo(imagename, 
     APIsource = "https://commons.wikimedia.org/w/api.php", 
     module = "imageinfo", 
     details = c("url", "metadata", "size", "extlinks"), testURL = TRUE)

Arguments

imagename
Wikimedia commons unique image title
APIsource
location of the API service
module
default module
details
detailed parameters of interest
testURL
logical; species if the program should first test whether the image exist at all (recommended)

Details

Although this is often not visible in picture editing programs, almost any image uploaded to Wikimedia contains usefull EXIF metadata. However, it is highly recommended that you insert the some important tags in the image header yourself, by using e.g. the http://www.sno.phy.queensu.ca/~phil/exiftool/{EXIF tool} (courtesy of Phil Harvey), before uploading the files to Wikimedia. The getWikiMedia.ImageInfo function assumes that all required metadata has already been entered by the user before the upload, hence no further changes in the metadata will be possible. Examples of how to embed EXIF tags into an image file are available http://commons.wikimedia.org/wiki/Commons:EXIF{here}. To geocode an uploaded image consider adding: {{location|lat deg|lat min|lat sec|NS|long deg|long min|long sec|EW}} tag to the file description, in which case getWikiMedia.ImageInfo will automatically look for the attached coordinates via the external links. For practical purposes and because the image properties information determined by the Wikimedia system can are more reliable, the function will rewrite some important EXIF metadata (image width and height) using the actual values determined by Wikimedia server. For a list of modules and parameters that can be used via getWikiMedia.ImageInfo, please refer to http://www.mediawiki.org/wiki/API{Wikimedia API manual}.

References

  • Wikimedia API (http://www.mediawiki.org/wiki/API)
  • EXIF tool (http://www.sno.phy.queensu.ca/~phil/exiftool/)
  • EXIF Tags (http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html)

See Also

spPhoto, Rexif::getExifPy

Examples

Run this code
# Photo taken using a GPS-enabled camera:
imagename = "Africa_Museum_Nijmegen.jpg"
x <- getWikiMedia.ImageInfo(imagename)
# Get the GPS info:
x$metadata[grep(names(x$metadata), pattern="GPS")]
# prints the complete list of metadata tags;

Run the code above in your browser using DataLab