4

I've geotagged photos stored locally on my computer, which were converted into points.

But I am not happy about where those points are placed by (not very accurate GPS).

On the map, I know for sure, where points should be. I know, that I can manually move points, but GPS place in photos won't change if I'll remove and add them again.

Is there any tool or command to move the geotagged photo and change GPS place in a photo with it.

  • 1
    Can you please describe the software and tools which you have access or you prefer to deploy? How and where these photos are stored? Are you willing to modify points or photos metadata? – Taras Feb 21 at 11:16
  • Iam using Arcgis PRO. i have access to all basic tools arcgis pro have to offer. Photos are stored in my computer and iam willing to modify photos metadata through points. – Darius Feb 21 at 13:19
  • Makes me wonder: How can I make sure geotagged coordinates have not been modified? – Kirk Kuykendall Feb 21 at 17:38
  • Exiftool can be used for this: sno.phy.queensu.ca/~phil/exiftool – mikewatt Feb 21 at 19:17
3

This script will take as an input a folder of images, and a shapefile. The shapefile needs to be attributed with the image name, and the lat and long of the point. The script will write to the EXIF tag of the image the lat and long from the attribute table. After execution the image location will be the same as the point location. The script requires the pyexiv2 library and therefore, only works with Python 2.7 and ArcGIS 10.x. I will port it to Python 3 if anyone asks. Make a backup of your data before you run this code!

import pyexiv2, traceback, sys, arcpy
#the folder of images...
inFolder = "C:/gTemp/WriteEXIFtest/sfnooksack_lo"
#The points that show the correct image locations...
inFC = 'C:/gTemp/WriteEXIFtest/sfnooksack_lo.shp'
#the shapefile needs to have attributes with the image name, lat and long (as DD)
fields = ['IMAGE', 'lat', 'long']
try:
    def ddlongtodms(dd):
        #converts decimal degrees to degrees minutes and seconds.
        if dd < 0:
            dd = abs(dd)
            GPSLongitudeRef = 'W'
        else:
            GPSLongitudeRef = 'E'
        minutes,seconds = divmod(dd*3600,60)
        degrees,minutes = divmod(minutes,60)
        return (GPSLongitudeRef,int(degrees),int(minutes),seconds)
    def ddlattodms(dd):
        #converts decimal degrees to degrees minutes and seconds.
        if dd < 0:
            dd = abs(dd)
            GPSLatitudeRef = 'S'
        else:
            GPSLatitudeRef = 'N'
        minutes,seconds = divmod(dd*3600,60)
        degrees,minutes = divmod(minutes,60)
        return (GPSLatitudeRef,int(degrees),int(minutes),seconds)
    with arcpy.da.SearchCursor(inFC, fields) as cursor:
        for row in cursor:
            #in this case the image name does not have a .jpg suffix so I add it here...
            imagePath = inFolder +'/'+row[0]+'.jpg'
            print imagePath
            pointLong = ddlongtodms(row[2])
            pointLat = ddlattodms(row[1])
            print pointLong
            print pointLat
            try:
                metadata = pyexiv2.ImageMetadata(imagePath)
                metadata.read()
                latitude = [pyexiv2.Rational(pointLat[1],1),pyexiv2.Rational(pointLat[2], 1),pyexiv2.Rational(int(pointLat[3]*100000), 100000)]
                longitude = [pyexiv2.Rational(pointLong[1],1),pyexiv2.Rational(pointLong[2], 1),pyexiv2.Rational(int(pointLong[3]*100000), 100000)]
                metadata['Exif.GPSInfo.GPSLatitude'] = latitude
                metadata.write()
                metadata['Exif.GPSInfo.GPSLongitude'] = longitude
                metadata.write()
                metadata['Exif.GPSInfo.GPSLatitudeRef'] = pointLat[0]
                metadata.write()
                metadata['Exif.GPSInfo.GPSLongitudeRef'] = pointLong[0]
                metadata.write()
            except:
                print "something bad happened with this file..."
    print "Done"
except:
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
    print pymsg + "\n"
  • Thank You a lot, GBG. This is best solution so far. But in work, i only have arcgis pro vers. 2, which uses 3rd python i guess. – Darius Feb 21 at 18:06
  • You told. you can port this scrpt to Python 3. Can you still do that ? :) – Darius Feb 22 at 8:25
3

I recomend JOSM with plugins 'photo_geotagging' and 'photoadjust'.

  1. Start JOSM
  2. F12 --> Settings --> Install plugins
  3. Layers --> OpenStreetMap Carto
  4. Drag-and-drop all your photos
  5. Activate photo layer. Click on photo. Shift + Mouse Click: move photo, Ctrl + Mouse Click: set GPSImgDirection tag enter image description here
  6. Photos layer --> Context menu --> Write coordinates to image header --> check "Change file modification time - to previous value"

enter image description here This software has much faster GUI than GeoSetter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.