Update GPS information

Started by LayneSeely, March 31, 2025, 01:59:34 PM

Previous topic - Next topic

LayneSeely

Hi Gang:

Newbie here trying to find a solution to changing the GPS information from my drone (DMS) to UTM (Northings & Eastings).  I have a Python script that I have written that creates a CSV file reporting the DMS values.  I have run this CSV file through another program that converts these values into UTM coordinates.  Now what I want to do is update the actual photograph's coordinates with my UTM coordinates - can I do this in batch (i.e., for a complete folder) with this tool?  If this is possible, how would I do this?  Is it possible through Python?

I have attached output from this tool and what I want it to go to for reference for the same photo.

Layne

reference.gif
Output.jpg

Phil Harvey

Hi Layne,

This ExifTool config file allows you to convert GPS coordinates to UTM when reading from file.

...but where do you plan on storing them if you want to write them back to the file?  EXIF doesn't support UTM coordinates.  (MIE format does :) but there's not much support for that.)

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LayneSeely

Thank you for your reply.  I did not know if I could simply over-write the data in the image.  If I could add new data(i.e., new attributes) then maybe it would work.

At this point, at least now I know that EXIF V. 0230 doesn't support UTM coordinates.  One option down - many more to go.

LayneSeely

hey Phil:

With a change to my software, I now have output coordinates in the right format.  I think I should now be able to update the Lat, Long and Elev attributes for each photo in my folder.  I'd rather not do this one-by-one as often there are hundreds to thousands of photos per drone flight; thus, I'm thinking of doing this programmatically - likely with Python.  Feeding into a python script the necessary variables by reading in a single row at a time is straight forward, but what would the ExifTool command be?

Phil Harvey

I don't know enough about what you want to do to be able to give you a command.

Generally, the commands to do similar things are:

1. Extract GPS from video to GPX file:

exiftool -p gpx.fmt -ee VIDEOFILE > out.gpx

2. Geotag photos based on extracted GPX:

exiftool -geotag out.gpx -ext jpg DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LayneSeely

hey Phil - sorry for being MIA for a while.  Here is my problem and what I would like to do using your tool.
Drones report their elevations in WGS84 and my GIS software is having difficulties converting WGS84 elliptical elevations to something more useful in my GIS system. 
Step 1 for me would be to create a csv file containing the relevant GPS exif information in it's default format (with as many decimal places as possible). 
Step 2 for me would then be using another piece of software to convert the elevations into corrected elevations in a "corrected" csv file. 
Step 3 for me would then be to overwrite the elevation exif information in a copy of the original photo from the corrected csv file.  I think this is doable but would really appreciate your help in tweaking the command lines.
Layne

Phil Harvey

Use this command to output lat/lon/elevation:

If we're talking photos, then this is easy:

1. exiftool -csv -gpslatitude -gpslongitude -gpsaltitude -n DIR > out.csv

Then edit the altitude values of the CSV and write the new altitudes back to the files with:

2. exiftool -csv=out.csv -gpsaltitude DIR

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LayneSeely

hey Phil:

Thanks SO much for this - it is greatly appreciated.  Yes the main focus was for photos; however, now that you mention it, generating coordinates from a video might be handy as well - but you gave me those instructions previously.

Layne

LayneSeely

#8
hey Phil
I have adapted the commands that you gave to me, thanks again.
Command 1
exiftool -csv -gpslatitude -gpslongitude -gpsaltitude -relativealtitude -createdate -n C:\_LOCALdata\RPAS\Ben_Misner\GRL39668\Flights\DJI_202410111048_001_NorthSouthFence > C:\_LOCALdata\RPAS\Ben_Misner\GRL39668\Flights\DJI_202410111048_001_NorthSouthFence\Exif2CSV.csv

However; when I run Command 2, it fails saying there is no SourceFile in the imported CSV database.
exiftool -csv=C:\_LOCALdata\RPAS\Ben_Misner\GRL39668\Flights\DJI_202410111048_001_NorthSouthFence\GpsHOut.csv -gpsaltitude C:\_LOCALdata\RPAS\Ben_Misner\GRL39668\Flights\DJI_202410111048_001_NorthSouthFence

Any thoughts on what I did that is not working?  I am wondering if the GpsHOut file needs to have the header \ column names and this is why it is not working?

Layne

Phil Harvey

Hi Layne,

Your file GpsHOut.csv is missing the column headings.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

LayneSeely

hey Phil:

Yes it is - is that why the second command did not work?

Layne

StarGeek

From the docs on the -csv option (emphasis mine)
QuoteWhen importing, the CSV file must be in exactly the same format as the exported file. The first row of the CSVFILE must be the ExifTool tag names (with optional group names) for each column of the file, and values must be separated by commas.

I'm not trying to be an ass, but how do you think exiftool is going to know what tags to fill in if the header is removed.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

LayneSeely

hey Phil:

Thank you again SO SO much for your help.  Well it seems that my software does not actually use the exif info for GPS Altitude but rather the exif info called "Absolute Altitude".  Is there somewhere that I can find out the difference between these two pieces of information?

Thank you StarGeek for your comments, they are appreciated.

Layne

StarGeek

Quote from: LayneSeely on June 11, 2025, 05:41:33 PMWell it seems that my software does not actually use the exif info for GPS Altitude but rather the exif info called "Absolute Altitude".  Is there somewhere that I can find out the difference between these two pieces of information?

You might want to figure out what group the tag belongs to because AbsoluteAltitiude isn't an EXIF tag. Use the command in FAQ #3 to list the groups as well as duplicate tags.

Odds are it is the XMP-drone-dji:AbsoluteAltitude, though there are a couple other AbsoluteAltitude tags, but I don't think they would apply here.

As for the exact meaning, AFAIK, DJI hasn't released any documentation on it. You can search these forums to see if it has popped up before. Or search elsewhere on the web for a more DJI specific source of information.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

LayneSeely

#14
hey StarGeek:

You are correct.  See attached file.

AbsoluteAltitude.jpg

I will reach out to DJI and see if I can get any further info from their support folks and get back with any information that they provide.

Layne