Hi,
This is my first post! I just downloaded exiftool and it is amazing. I have an issue with some 30,000 photos where I accidentally mixed them up. I have 2 drone mapping scenarios, with different altitudes. I need to find the photos done at 60m and the ones done at 120m and put them in separate folders.
I assume exiftool can do that based on other topics, but I need a little help on how to do this on Windows. I just downloaded the latest version, so any help is appreciated.
Thanks
Having just looked at a drone photo I see absolute and relative altitudes.
You can use this command to see all the tags with "Alt" in their names:
exiftool -s "-*Alt*" <filename>
Sample output:
GPSAltitudeRef : Above Sea Level
AbsoluteAltitude : 341.345
RelativeAltitude : +90.096
GPSAltitude : 341 m Above Sea Level
The altitudes also seem to have three decimal places so I assume you want to round down to 60m or 120m
The command would be (for the current directory) :
exiftool -if "$AbsoluteAltitude=~/\+60\./" "-Directory=dir" .
if you want to use an altitude range then it would be something like
exiftool -if "$AbsoluteAltitude > 60 and $AbsoluteAltitude < 61" "-Directory=dir" .
Caveat : I tried this using a Mac where the syntax may be slightly different - test carefully before you run it on your 30,000 photos
Make sure and use CMD, not PowerShell, as PSs quoting rules are different from every other command line.
Your conditions are a little vague. Do you mean images with an exact altitude of 60 and 120? Or do you mean something like
0-60
61-120
120+
If your files don't have an AbsoluteAltitude tag, then you can use GPSAltitude, but you would want to add a hashtag to the end of it, e.g. GPSAltitude#. This allows comparing the raw number without the extra text (though it might still work either way, Perl is flexible about this IIRC).
Hi @greybeard
Thank you for the quick replies! This tool is awesome.
I ran the command on a few photo and I got strangely different results:
GPSAltitudeRef : Above Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : +83.568
RelativeAltitude : +249.900
GPSAltitude : 83.5 m Above Sea Level
GPSAltitudeRef : Above Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : +176.981
RelativeAltitude : +200.000
GPSAltitude : 176.9 m Above Sea Level
GPSAltitudeRef : Above Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : +176.981
RelativeAltitude : +200.000
GPSAltitude : 176.9 m Above Sea Level
GPSAltitudeRef : Below Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : -14.568
RelativeAltitude : +59.900
GPSAltitude : 14.5 m Below Sea Level
I think the RelativeAltitude would be the best bet. I don't understand why the drone would think I am below sea level, but ok.
The first ones I was indeed at 200m and the last one I was at 60m (59.9 is close enough).
I think I would need to put a range of 50-70 and then 190-210, for example, to separate the two main types. I ran two sets of flights at 60m and 200m (not 120m as I had said before, my mistake).
So I ran this:
exiftool -if "$AbsoluteAltitude > 50 and $AbsoluteAltitude < 70" "-Directory=dir" .
and it failed with this:
1 directories scanned
642 files failed condition
0 image files read
Then I ran
exiftool -if "$RelativeAltitude > 50 and $RelativeAltitude < 70" "-Directory=dir" .
and got:
1 directories scanned
1 files failed condition
643 image files updated
So it managed to sort 642 of 643, which is what I expected from the sample, so it worked!
Lastly, I ran
Exiftool\exiftool -if "$RelativeAltitude > 120 " "-Directory=dir2" .
1 directories scanned
1 directories created
1 image files updated
and it sorted the last image, which was above 120m
Thank you! This is amazing!
Quote from: StarGeek on March 15, 2025, 11:19:15 AMMake sure and use CMD, not PowerShell, as PSs quoting rules are different from every other command line.
Your conditions are a little vague. Do you mean images with an exact altitude of 60 and 120? Or do you mean something like
0-60
61-120
120+
If your files don't have an AbsoluteAltitude tag, then you can use GPSAltitude, but you would want to add a hashtag to the end of it, e.g. GPSAltitude#. This allows comparing the raw number without the extra text (though it might still work either way, Perl is flexible about this IIRC).
Thank you so much for your input! Yes, I use CMD - I though Powershell would not be the best for this.
What I meant is I have photos taken at 60m (so let's say 55 to 65m, but the drone should always be at 60m above take-off). I have another set that was taken at 200m (let's say 195 to 205m) and I mixed them up accidentally. Now I need to sort them into two folders, for they are different sets of data.
QuoteIf your files don't have an AbsoluteAltitude tag, then you can use GPSAltitude, but you would want to add a hashtag to the end of it, e.g. GPSAltitude#. This allows comparing the raw number without the extra text (though it might still work either way, Perl is flexible about this IIRC).
Yes, I love Perl! It worked great with RelativeAltitude. I am still puzzled by some of the results for the GPS data - especially that one that says BELOW SEA LEVEL!
Thanks again!
Quote from: aeciolemos on March 15, 2025, 04:13:32 PMI am still puzzled by some of the results for the GPS data - especially that one that says BELOW SEA LEVEL!
What are the GPS coordinates for that file? Though it could have been a glitch.
Quote from: StarGeek on March 15, 2025, 04:46:23 PMQuote from: aeciolemos on March 15, 2025, 04:13:32 PMI am still puzzled by some of the results for the GPS data - especially that one that says BELOW SEA LEVEL!
What are the GPS coordinates for that file? Though it could have been a glitch.
So sorry for not replying sooner. I didn't see you had replied.
DJI_20250206121038_0180_D.JPG:
GPSAltitudeRef : Below Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : -95.525
RelativeAltitude : +84.900
GPSAltitude : 95.5 m Below Sea Level
I got all the GPS tags:
GPSVersionID : 2.3.0.0
GPSLatitudeRef : North
GPSLongitudeRef : West
GPSAltitudeRef : Below Sea Level
GPSStatus : Measurement Active
GPSMapDatum : WGS-84
GpsStatus : Normal
GPSAltitude : 95.5 m Below Sea Level
GPSLatitude : 53 deg 33' 33.42" N
GPSLongitude : 7 deg 42' 8.78" W
GPSPosition : 53 deg 33' 33.42" N, 7 deg 42' 8.78" W
Here is this photo for you to test on. As you can see I was pretty much above sea level :)
These above are for DJI_20250206121038_0180_D.JPG. I have also uploaded a second one with BELOW SEA LEVEL data: DJI_20250206121146_0183_D.JPG
I also included DJI_20250206160602_0592_D.JPG in that album, which now shows ABOVE sea level:
"C:\Util\Exiftool\exiftool(-k).exe" -s "-*Alt*" DJI_20250206160602_0592_D.JPG
GPSAltitudeRef : Above Sea Level
AltitudeType : GpsFusionAlt
AbsoluteAltitude : +83.568
RelativeAltitude : +249.900
GPSAltitude : 83.5 m Above Sea Level
"C:\Util\Exiftool\exiftool(-k).exe" -s "-*GPS*" DJI_20250206160602_0592_D.JPG
GPSVersionID : 2.3.0.0
GPSLatitudeRef : North
GPSLongitudeRef : West
GPSAltitudeRef : Above Sea Level
GPSStatus : Measurement Active
GPSMapDatum : WGS-84
GpsStatus : Normal
GPSAltitude : 83.5 m Above Sea Level
GPSLatitude : 53 deg 33' 20.34" N
GPSLongitude : 7 deg 42' 24.85" W
GPSPosition : 53 deg 33' 20.34" N, 7 deg 42' 24.85" W
Note that these were all taken on the same day, in sequence.
https://photos.app.goo.gl/jXpEFKoZX62k6Tos5
Quote from: aeciolemos on April 18, 2025, 06:16:30 AMSo sorry for not replying sooner. I didn't see you had replied.
Notifications are not on automatically. See this post (https://exiftool.org/forum/index.php?msg=87615) on how to turn them on.
Yeah, I got nothing looking at that.
But searching around on the web, it appears that the altitude is measured by a barometer in the drone and not by the GPS signal VDOP. And that can be inaccurate depending upon weather conditions and if the sensor is dirty or not.
DJI forum post (https://forum.dji.com/forum.php?mod=viewthread&tid=270497)
MavicPilots forum post (https://mavicpilots.com/threads/altitude-reading-issues.118367/)
Reddit post (https://www.reddit.com/r/drones/comments/10moad1/issues_with_the_reliability_of_altitude_data_with/)
Thanks for getting back on this, curiosity satisfied.
Quote from: StarGeek on April 18, 2025, 11:01:16 AMThanks for getting back on this, curiosity satisfied.
I would not in a million years think they would use a barometric altitude sensor! Why? I mean, ok, they want the height from take-off to control a bunch of things, but I wonder if there is a way to get the GPS altitude. Maybe it is in these tags:
Absolute Altitude : -95.525 --> Barometric sensor?
Relative Altitude : +84.900 --> GPS data?
However, I then question the GPSAltitudeRef tag that shows below sea level.
GPSAltitudeRef : Below Sea Level
GPSAltitude : 95.5 m Below Sea Level
And I also see this
AltitudeType : GpsFusionAlt
which, from my research means FUSED ALTITUDE. In other words, it combines the barometric sensor altitude with the GPS altitude.
None of this explains why DJI would record this data in the GPS tags, they should leave those as RAW GPS data.
So, as the links you sent suggest, the barometric sensor can get dirty (which was not my case, I clean the drones before operation for better performance with a vacuum cleaner) OR IN MY CASE A STORM FRONT COMING IN!!! This is Ireland. Storms and change of weather is a daily occurance. We usually get all 4 seasons in a day and that was a long mission, so I had to land several times due to rain coming in, so that would explain the issue.
SO, my conclusion is, I need to use some other field. I scanned some 14k files and extracted the tags. It seems RELATIVE ALTITUDE is the one I need to go with.
(https://photos.app.goo.gl/1GXfArvawGZ6M39U7)
https://photos.app.goo.gl/1GXfArvawGZ6M39U7
I mean, what I need here is to separate the two missions, one I flew at 60m and the second one at 200m (Yes, I had permission hehehe). I can do an -if < 100 and -if > 99 and that should do what I need. Geez, I never thought this would be so complicated! It would almost be easier to go back and tell the client I will fly it all again LOL