DJI Mavic, Air and Mini Drones
Friendly, Helpful & Knowledgeable Community
Join Us Now

Altitude information from exif data photos

Joined
Apr 23, 2017
Messages
6
Reactions
0
Age
51
Hi all,

Is there any way to find altitude data from photo taken with Mavic other than looking from flight record ?
Do we need third party apps to do that ?

Thanks
 
The EXIF data actually includes all 3 coordinates, but the altitude there is above sea level, as sampled from the GPS. You will have to find out whats the ground level at that lon/lat and subtract it in order to get the actual, AGL, altitude. Not sure if there is a premaid app for this, but something tells me coding some simple python script that reads the EXIF, gets the ground level from somewhere, and spits out the delta, won't take a lot of effort.
 
Here, I've actually coded a script that does it. Takes the elevation from api.open-elevation.com. Tested with python 2.7.13, with appropriate packages, such as exifread (pip install as needed).
 

Attachments

  • get_alt.zip
    755 bytes · Views: 162
Here, I've actually coded a script that does it. Takes the elevation from api.open-elevation.com. Tested with python 2.7.13, with appropriate packages, such as exifread (pip install as needed).

Thanks for your file.
Do you know how I can use it ? since i dont know about phyton at all.
 
Well, i've just coded it, obviously i know how to use it :)
  1. Install python.
    I've only tested it on 2.7, but feel free to test and adapt this little script for 3.* as necessary (or just use 2.7).
    Code:
    >>> https://www.python.org/downloads/
  2. Install the "exifread" package This is as simple as executing the following command line:
    Code:
    pip install exifread
  3. Run the script from command line, provide the picture file to it as the first argument, for example:
    Code:
    python c:\myscripts\get_alt.py  "MyDjiPic0123.jpeg"
    or just
    Code:
    get_alt.py  "MyDjiPic0123.jpeg"
    assuming you have python associated with .py files and get_alt.py is somewhere in your path.
Example:
Code:
get_alt.py "0524 - Red Rock Canyon, NV, USA.DNG"
Latitude[deg]     : 36.149939
Longitude[deg]    : -115.425493
Altitude [m, ASL] : 1308.659000
Altitude [m, AGL] : 86.659000
 
  • Like
Reactions: s2seyecle
Looks very good. Is it possible to convert it to .exe so I don’n need to install phyton ?
Maybe. Can try on Monday (AFK now). I fully expect any python "compilers" to pull half of the python in, as runtimes or statically. If thats the case, one is probably better off installing python. Which also allows you to code/modify this kind of stuff at will.
 
Does it pull the ground altitude from somewhere and calculate AGL altitude as well?

Here a sample output:

ExifTool Version Number : 10.61
File Name : PANO0001.JPG
Directory : .
File Size : 4.5 MB
File Modification Date/Time : 2017:12:15 13:18:00+01:00
File Access Date/Time : 2017:12:15 16:47:08+01:00
File Creation Date/Time : 2017:12:15 13:18:00+01:00
File Permissions : rw-rw-rw-
File Type : JPEG
File Type Extension : jpg
MIME Type : image/jpeg
Exif Byte Order : Little-endian (Intel, II)
Image Description : DCIM\PANORAMA\100_0130\PAN
Camera Model Name : FC220
Orientation : Horizontal (normal)
X Resolution : 72
Y Resolution : 72
Resolution Unit : inches
Software : v02.06.5663
Modify Date : 2017:12:15 13:18:00
Y Cb Cr Positioning : Centered
Exposure Time : 1/400
F Number : 2.2
Exposure Program : Manual
ISO : 100
Exif Version : 0230
Date/Time Original : 2017:12:15 13:18:00
Create Date : 2017:12:15 13:18:00
Components Configuration : -, Cr, Cb, Y
Compressed Bits Per Pixel : 2.873252
Shutter Speed Value : 1/400
Aperture Value : 2.2
Exposure Compensation : 0
Max Aperture Value : 2.2
Subject Distance : 0 m
Metering Mode : Center-weighted average
Light Source : Daylight
Flash : No flash function
Focal Length : 4.7 mm
Warning : [minor] Possibly incorrect maker notes offsets (fix by 1415?)
Make : DJI
Speed X : -0.10
Speed Y : +0.00
Speed Z : +0.10
Pitch : +2.90
Yaw : +165.30
Roll : +15.50
Camera Pitch : -90.00
Camera Yaw : +165.00
Camera Roll : +179.90
Flashpix Version : 0010
Color Space : sRGB
Exif Image Width : 4000
Exif Image Height : 3000
Interoperability Index : R98 - DCF basic file (sRGB)
Interoperability Version : 0100
Exposure Index : undef
File Source : Digital Camera
Scene Type : Unknown (0)
Custom Rendered : Normal
Exposure Mode : Manual
White Balance : Manual
Digital Zoom Ratio : undef
Focal Length In 35mm Format : 26 mm
Scene Capture Type : Standard
Gain Control : None
Contrast : Normal
Saturation : High
Sharpness : Normal
Device Setting Description : (Binary data 4 bytes, use -b option to extract)
Subject Distance Range : Unknown
GPS Version ID : 3.2.0.0
GPS Latitude Ref : North
GPS Longitude Ref : East
GPS Altitude Ref : Above Sea Level
XP Comment : 0.9.143
XP Keywords : N
Compression : JPEG (old-style)
Thumbnail Offset : 41984
Thumbnail Length : 6959
About : DJI Meta Data
Format : image/jpg
Absolute Altitude : +638.55
Relative Altitude : +48.30
Gimbal Roll Degree : +179.90
Gimbal Yaw Degree : +165.00
Gimbal Pitch Degree : -90.00
Flight Roll Degree : +15.50
Flight Yaw Degree : +165.30
Flight Pitch Degree : +2.90
Calibrated Focal Length : 3032.258057
Calibrated Optical Center X : 2000.000000
Calibrated Optical Center Y : 1500.000000
Version : 7.0
Has Settings : False
Has Crop : False
Already Applied : False
MPF Version : 0010
Number Of Images : 2
MP Image Flags : Dependent child image
MP Image Format : JPEG
MP Image Type : Large Thumbnail (VGA equivalent)
MP Image Length : 306510
MP Image Start : 4367157
Dependent Image 1 Entry Number : 0
Dependent Image 2 Entry Number : 0
Image UID List : (Binary data 66 bytes, use -b option to extract)
Total Frames : 1
Image Width : 4000
Image Height : 3000
Encoding Process : Baseline DCT, Huffman coding
Bits Per Sample : 8
Color Components : 3
Y Cb Cr Sub Sampling : YCbCr4:2:2 (2 1)
Aperture : 2.2
GPS Altitude : 638.5 m Above Sea Level
GPS Latitude : 48 deg 17' 49.48" N
GPS Longitude : 11 deg 50' 8.74" E
GPS Position : 48 deg 17' 49.48" N, 11 deg 50' 8.74" E
Image Size : 4000x3000
Preview Image : (Binary data 306510 bytes, use -b option to extract)
Megapixels : 12.0
Scale Factor To 35 mm Equivalent: 5.5
Shutter Speed : 1/400
Thumbnail Image : (Binary data 6959 bytes, use -b option to extract)
Circle Of Confusion : 0.005 mm
Field Of View : 69.4 deg
Focal Length : 4.7 mm (35 mm equivalent: 26.0 mm)
Hyperfocal Distance : 1.85 m
Light Value : 10.9
 
  • Like
Reactions: s2seyecle
Thats pretty much a dump of parsed EXIF data, every last bit of it, i guess. EXIF data doesn't contain AGL altitude. And i see nothing wrong in just scripting something that asks OSM API for ground level at given coordinates, subtracting it automatically, like i did :)
 
With Windows on-board tools you receive similar, reduced output.
You can modify the command with parameters as you like; Here a simple command:

exiftool.exe PANO001.JPG | findstr /c:"GPS Latitude" /c:"GPS Longitude" /c:"Altitude" | find /V "Ref"

produces this output:

Absolute Altitude : +638.75
Relative Altitude : +48.50
GPS Altitude : 638.7 m Above Sea Level
GPS Latitude : 48 deg 17' 49.46" N
GPS Longitude : 11 deg 50' 8.76" E
 
  • Like
Reactions: borislip
With Windows on-board tools you receive similar, reduced output.
You can modify the command with parameters as you like; Here a simple command:

exiftool.exe PANO001.JPG | findstr /c:"GPS Latitude" /c:"GPS Longitude" /c:"Altitude" | find /V "Ref"

produces this output:

Absolute Altitude : +638.75
Relative Altitude : +48.50
GPS Altitude : 638.7 m Above Sea Level
GPS Latitude : 48 deg 17' 49.46" N
GPS Longitude : 11 deg 50' 8.76" E
Didn't notice the relative altitude, thanks. I wonder where is it getting that from, cause thats not a part of exif, as far as i know.
 
I wonder where is it getting that from, cause thats not a part of exif
It's from the XMP part.

XMP

About DJI Meta Data
Modify Date 2014:10:13
3 years, 3 months, 10 days, 7 hours, 56 minutes, 13 seconds ago
Create Date 2014:10:13
3 years, 3 months, 10 days, 7 hours, 56 minutes, 13 seconds ago
Format image/jpg
Absolute Altitude +638.75
Relative Altitude +48.50
Gimbal Roll Degree +179.90
Gimbal Yaw Degree +164.70
Gimbal Pitch Degree -90.00
Flight Roll Degree +14.10
Flight Yaw Degree +165.80
Flight Pitch Degree +7.30
Calibrated Focal Length 3032.258057
Calibrated Optical Center X 2000.000000
Calibrated Optical Center Y 1500.000000
Version 7.0
Has Settings False
Has Crop False
Already Applied False

edit: inserted XMP table
 
  • Like
Reactions: borislip
I question the accuracy of the altitude value in the exim data. There is a location where I often fly. It is at ~4,500ft elevation ASL. From two recent flights there, the photos have altitude values of 1,394 and 1,459. I never exceeded 400ft AGL on either flight. These values aren't even in the ballpark.
 
I question the accuracy of the altitude value
Maybe the units got mixed up ... ft or m.

Can you upload a sample with the relevant GPS/Altitude data?
 
untouched images
Thank you very much.

According to exiftool.exe:

Absolute Altitude : +1394.07
Relative Altitude : +58.70
GPS Altitude : 1394 m Above Sea Level
GPS Latitude : 39 deg 18' 5.91" N
GPS Longitude : 120 deg 41' 41.79" W

the data seems plausible:
1394.07 m ~ 4573 ft AMSL (Take off)
Altitude where the image was taken is: 58.70 m ~ 193 ft AGL


All units displayed are in meters.
 
Lycus Tech Mavic Air 3 Case

DJI Drone Deals

New Threads

Forum statistics

Threads
131,064
Messages
1,559,478
Members
160,046
Latest member
Opus3