[R-sig-Geo] Reading latitude longitude data from geotags

Michael Sumner mdsumner at gmail.com
Wed Jun 12 15:34:18 CEST 2013

You can get a start at this with rgdal, I used GDALinfo to read in
EXIF metadata from one of the example files here:


x <- GDALinfo("AcerCE-5330.jpg")
 attr(x, "mdata")
[1] "EXIF_ColorSpace=1"
"EXIF_ComponentsConfiguration=0x1 0x2 0x3 00"       "EXIF_Contrast=0"
 [4] "EXIF_CustomRendered=0"
"EXIF_DateTime=2009:10:10 22:58:22"
"EXIF_DateTimeDigitized=2009:10:10 22:58:22"  ...

I'm not familiar with this system so I don't know whether other files
have the position informationm but it might be worth a look on your
file and you could parse those strings easily enough.

A search for "exif" using sos pulled up a few more possible leads too:


(I'm not sure if the name of the "sos" "findFn" function is mean to be
ironic somehow, but I often type it incorrectly and have to look it up

Cheers, Mike.

On Wed, Jun 12, 2013 at 11:11 PM, Proosdij, Andre van
<andre.vanproosdij at wur.nl> wrote:
> Dear colleagues,
> I want to read the latitude/longitude data from jpeg pictures. In the properties of the jpeg file, one can read the GPS coordinates in case the picture was taken using a camera with built-in GPS. Now I would like to use a R function to read these geotag data from the file and store it in a data.frame or matrix or other R object.
> 1) I tried getWikiMedia.ImageInfo from the plotKML package, but that doesn't work, probably because it was built to only read files directly from Wikimedia.
> ## Not run:
> imagename = "D:/R/IMG_5512.JPG"
> x <- getWikiMedia.ImageInfo(imagename)
> ## End (Not run)
> 2) I downloaded the exiftool (http://owl.phy.queensu.ca/~phil/exiftool/ ). One can drag and drop a jpeg file onto the exiftool(-k).exe file. The command line opens and displays the metadata. However, I wish to read this data into a data.frame or matrix in R.
> Any suggestions which function in which package could be used?
> Thanks in advance for your help!
> André
> Ir. A.S.J. van Proosdij
> PhD Student
> t   +31 317 48 1198
> e  andre.vanproosdij at wur.nl<mailto:andre.vanproosdij at wur.nl>
> Naturalis Biodiversity Center, section NHN
> Biosystematics Group, Wageningen University
> Gen. Foulkesweg 37, 6703 BL Wageningen, the Netherlands
> www.bis.wur.nl<http://www.bis.wur.nl/>
>         [[alternative HTML version deleted]]
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Michael Sumner
Hobart, Australia
e-mail: mdsumner at gmail.com

More information about the R-sig-Geo mailing list