How to add GPS latitude and longitude using Exiftool in mac (how to edit meta data in jpeg)

不羁的心 提交于 2019-12-07 22:55:17

问题


I have a bunch jpeg image that is obtained from FLIR camera. Along with that images I collected the GPS coordinates also. Now I'm trying to take the GPS latitude and longitude to the metadata of the image.

I wrote a program in R programming language to find the GPS location of each image with respect to the time(when ever the GPS location time and the camera time matches, I took that coordinates).

ie, for a particular image, I have GPSLatitude <- 19.33423 and GPSLongitude <- 72.090834

But now I need to add those exact GPS location to the image.

I tried to do that with Exiftool. I'm using Mac osX sierra. In that I installed exiftool. But now I don't know the how to update GPS data using that.

Can anyone help me. If possible let me know the method to update the data directly from the R programming language itself

Thanks


回答1:


Result from the thread on the exiftool forum

output <- system(sprintf("exiftool -GPSLatitude=%f -GPSLongitude=%f %s",q,p,aa))
or
output <- system(paste("exiftool -GPSLatitude=",q," -GPSLongitude=",p," ", aa))




回答2:


To add the gps coordinates with exiftool:

exiftool -XMP:GPSLongitude="-84.683333"  -XMP:GPSLatitude="10.502117"  -GPSLongitudeRef="West" -GPSLatitudeRef="North" photo.jpg

The values are just floating point numbers as got from Google Maps for example.




回答3:


When trying to do a similar thing as suggested by Casto Salobreña i got the following error:

$ exiftool -XMP:GPSLatitude=1.2843265 -XMP:GPSLongitude=36.8798949 -GPSLatitudeRef=South -GPSLongitudeRef=East -P test.jpeg 
Warning: Truncated PreviewIFD directory. IFD dropped. - test.jpeg
Error: [minor] Bad PreviewIFD directory - test.jpeg
    0 image files updated
    1 files weren't updated due to errors

to fix this i have dropped the Ref options removing and by changing the South direction (or potentially would need to do the same for West) to a negative number:

$ exiftool -XMP:GPSLatitude=-1.2843265 -XMP:GPSLongitude=36.8798949 -P test.jpeg 
    1 image files updated

now i test:

$ exiftool -l test.jpeg
...
GPS Position
    1 deg 17' 3.58" S, 36 deg 52' 47.62" E
...


来源:https://stackoverflow.com/questions/41849691/how-to-add-gps-latitude-and-longitude-using-exiftool-in-mac-how-to-edit-meta-da

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!