getWikiMedia.ImageInfo {plotKML}R Documentation

Gets EXIF information

Description

getWikiMedia.ImageInfo function fetches the EXIF (Exchangeable image file format) data via the 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 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 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 Wikimedia API manual.

Author(s)

Tomislav Hengl

References

See Also

spPhoto, Rexif::getExifPy

Examples

## Not run: # 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;

## End(Not run)

[Package plotKML version 0.5-6 Index]