Tutorial suitable for Agisoft Metashape Professional edition. DJI is writing two altitude information to the image metadata (XMP header of the image) - AbsoluteAltitude and RelativeAltitude (the latter defines the height above the take-off point). To the image EXIF the AbsoluteAltitude value is written. 

In some cases the default height in EXIF (AbsoluteAltitude) is incorrect. Metashape just reads EXIF and populates the corresponding fields of the Reference pane without any additional transformation of the coordinates. And if the invalid altitude information is read, then some additional corrections may be required. 

If the height above the ellipsoid of the take-off point is known, you can read the RelativeAltitude from the meta-information using the following script:

GitHub/metashape-scripts: https://github.com/agisoft-llc/metashape-scripts/blob/master/src/read_altitude_from_DJI_meta.py

And then add the known offset using another script:

GitHub/metashape-scripts: https://github.com/agisoft-llc/metashape-scripts/blob/master/src/add_altitude_to_reference.py

If the altitude is missing is XMP, Metashape will try to load it from the EXIF. The priority of meta data tags is the following:

AbsoluteAltitude - from http://www.dji.com/drone-dji/1.0/ XMP namespace

RelativeAltitude - from http://www.dji.com/drone-dji/1.0/ XMP namespace

GpsTag_Altitude - from EXIF

How to work with "add_altitude_to_reference.py" script:

1. Download the scripts from the links above (just plain text .py files).

2. Select Tools > Run script command.

3. Specify the path to the script file and click OK:

After that, you can find a new tab on the Toolbar: Custom menu. 

4. Select Custom menu > Add reference altitude...

5. Specify the height offset in the dialog window:

6. Click OK button and the input altitude value will be added to all the camera coordinates in the Reference pane.

7. After correcting the altitude information press Update button on the Reference pane to apply the changes.

Use the same steps as for "add_altitude_to_reference.py" to run the "real_altitude_from_DJI_meta.py" script. 

Additional notes regarding DJI data processing:

  • When working with DJI drone images we usually suggest unchecking Adaptive camera model fitting option in the Align Photos dialog: 

  • During the Optimization process include all the parameters and unchecking Adaptive camera model fitting option:

  • If no GCPs are used for Phantom RTK projects, it may be reasonable to enable Fit additional corrections option in the Optimize Cameras dialog:

  • if Phantom RTK is used, enable Load camera location accuracy from XMP metadata option in the Advanced preferences tab (select Tools > Preferences... and open Advanced tab) prior to the image loading in order to read and apply the measurement accuracy of the camera locations data.