Welcome Inspire Pilots!
Join our free DJI Inspire community today!
Sign up

Sorting out DJI's bad GPS altitude

Joined
Jan 14, 2014
Messages
2,043
Reaction score
491
Location
Bangor, Northern Ireland, UK
Website
irishsights.com
Hi all,
I posted this on the Photoscan forum so I thought I'd post it here as well. Its for getting more accurate pre-processed elevation data out of the EXIF meta-data that might be useful for some on here. Improvements welcome of course. This is currently what works best for me but still a work in progress.

OBJECTIVE
For non-survey grade projects without using pre-sampled Ground Control Points, to get as accurate as possible elevation data prior to processing in Photoscan Pro. In other words to get the most accurate map/model/orthomossaic/DEM etc as possible without using RTK GPS.

PROBLEM
The usual metadata tag that is used by these applications is the ‘GPSaltitude’ tag. Currently DJI populate this from the aircraft's GPS unit. The altitude recorded here is grossly inaccurate. We need to fix this as far as we can.

BASIC WORKFLOW
  • Establish and record the barometric altitude above mean sea level of your take-off point using an app.
  • Back in the office we need to process the meta-data from all the photos taken poking a more accurate figure into the GPSaltitude tag.
Thankfully DJI do record another tag called RelativeAltitude which populates the tag based on the height above your take-off point using the aircrafts barometer.

We want to add this RelativeAltitude value to the calibrated barometer reading we took from our phone/device at take-off to come up with an altitude above sea level figure for each photograph.

Then we want to write this combined value into the GPSaltitude tag that Photoscan Pro can use.

PREREQUISITES
• Go here and get the free Exiftool command line tool from Phil Harvey ExifTool by Phil Harvey
• For ease of use and file management I use a GUI version layer on top of this called exiftoolGUI.exe. Get it from here: Latest ExiftoolGUI version 5.16
• I use both the Exiftool AND the exiftoolGUI. You can just use the command-line tool if you are confident and familiar with using it. I like the easiest way out though!
• Download a barometer app for your phone/device. One that can be calibrated. As barometers are based on air pressure it needs calibrated around the time of take-off with some known weather station in your area to allow for the variance introduced by weather conditions. Make sure the app has this feature.

WORKFLOW
1. Record this AMSL altitude reading from the Barometer app at your take-off point at the time of photo aquisition.
2. Back in the office MAKE A COPY of the photos you want to process in a separate folder. THIS IS A MUST. If you cock the EXIF meta data up you cannot get it back!
3. In the ExiftoolGUI navigate to the folder that contains the COPIES of your photos.
4. At the bottom of the central pane there is a button labelled ‘Exiftool direct’…click it
5. In the command text box paste this text...
Code:
-n -GPSAltitudeRef=0 -tagsFromFile @ -RelativeAltitude>GPSAltitude *.*
and press enter. A small info box shows the status of the process. This copies the RelativeAltitude value into the GPSAltitude tag for all the photos in the folder
6. Now we want to add the AMSL value that we took from our phone/device at take-off. Delete any previous text from the command text box.
7. Take the previously recorded AMSL altitude from the phone/device and DIVIDE IT BY 2. Not sure why this has to be done (I may not have exactly the right syntax to use the full value…anyway this way it works!)
8. Paste this text in the command text box...
Code:
-n -tagsFromFile @ -GPSAltitude+=ALT *.*
BUT replace the ‘ALT’ with your 'divided by 2 value' and press enter.

DONE..BUT CHECK!
Always check and compare the metadata with the original files to make sure it did what you wanted it to do. Analyse the pop-up status info box for any errors.

Now you can process in Photoscan Pro as usual.


Any suggestions welcome of course...its just what works for me.
 
Last edited:
Joined
Sep 24, 2016
Messages
126
Reaction score
41
Age
66
Hi all,
I posted this on the Photoscan forum so I thought I'd post it here as well. Its for getting more accurate pre-processed elevation data out of the EXIF meta-data that might be useful for some on here. Improvements welcome of course. This is currently what works best for me.

OBJECTIVE
For non-survey grade projects without using pre-sampled Ground Control Points, to get as accurate as possible elevation data prior to processing in Photoscan Pro. In other words to get the most accurate map/model/orthomossaic/DEM etc as possible without using RTK GPS.

PROBLEM
The usual metadata tag that is used by these applications is the ‘GPSaltitude’ tag. Currently DJI populate this from the aircraft's GPS unit. The altitude recorded here is grossly inaccurate. We need to fix this as far as we can.

BASIC WORKFLOW
  • Establish and record the barometric altitude above mean sea level of your take-off point using an app.
  • Back in the office we need to process the meta-data from all the photos taken poking a more accurate figure into the GPSaltitude tag.
Thankfully DJI do record another tag called RelativeAltitude which populates the tag based on the height above your take-off point using the aircrafts barometer.

We want to add this RelativeAltitude value to the calibrated barometer reading we took from our phone/device at take-off to come up with an altitude above sea level figure for each photograph.

Then we want to write this combined value into the GPSaltitude tag that Photoscan Pro can use.

PREREQUISITES
• Go here and get the free Exiftool command line tool from Phil Harvey ExifTool by Phil Harvey
• For ease of use and file management I use a GUI version layer on top of this called exiftoolGUI.exe. Get it from here: Latest ExiftoolGUI version 5.16
• I use both the Exiftool AND the exiftoolGUI. You can just use the command-line tool if you are confident and familiar with using it. I like the easiest way out though!
• Download a barometer app for your phone/device. One that can be calibrated. As barometers are based on air pressure it needs calibrated around the time of take-off with some known weather station in your area to allow for the variance introduced by weather conditions. Make sure the app has this feature.

WORKFLOW
1. Record this AMSL altitude reading from the Barometer app at your take-off point at the time of photo aquisition.
2. Back in the office MAKE A COPY of the photos you want to process in a separate folder. THIS IS A MUST. If you cock the EXIF meta data up you cannot get it back!
3. In the ExiftoolGUI navigate to the folder that contains the COPIES of your photos.
4. At the bottom of the central pane there is a button labelled ‘Exiftool direct’…click it
5. In the command text box paste this text...
Code:
-n -GPSAltitudeRef=0 -tagsFromFile @ -RelativeAltitude>GPSAltitude *.*
and press enter. A small info box shows the status of the process. This copies the RelativeAltitude value into the GPSAltitude tag for all the photos in the folder
6. Now we want to add the AMSL value that we took from our phone/device at take-off. Delete any previous text from the command text box.
7. Take the previously recorded AMSL altitude from the phone/device and DIVIDE IT BY 2. Not sure why this has to be done (I may not have exactly the right syntax to use the full value…anyway this way it works!)
8. Paste this text in the command text box...
Code:
-n -tagsFromFile @ -GPSAltitude+=ALT *.*
BUT replace the ‘ALT’ with your 'divided by 2 value' and press enter.

DONE..BUT CHECK!
Always check and compare the metadata with the original files to make sure it did what you wanted it to do. Analyse the pop-up status info box for any errors.

Now you can process in Photoscan Pro as usual.


Any suggestions welcome of course...its just what works for me.

Just a side question.........Do you know if the Inspire 2 has this all worked out??
 
Joined
Oct 3, 2016
Messages
673
Reaction score
166
Age
47
Location
Devon, UK
For non-survey grade projects without using pre-sampled Ground Control Points, to get as accurate as possible elevation data prior to processing in Photoscan Pro. In other words to get the most accurate map/model/orthomossaic/DEM etc as possible without using RTK GPS.
is this workflow because you dont want the added agro of ground control points and gnss measurement, or because you dont have access to the kit to do it ?
 
Joined
Jan 14, 2014
Messages
2,043
Reaction score
491
Location
Bangor, Northern Ireland, UK
Website
irishsights.com
is this workflow because you dont want the added agro of ground control points and gnss measurement, or because you dont have access to the kit to do it ?
I buy in the service when needed or get clients to do RTK. As stated this is for when trying to get the best out of drones on its own which us fine for many of my jobs.

Still a few tweaks to add to it I have discovered. I'll confirm workflow modification in a bit.

PfCO Holder
BNUC-S Qualified
 
Joined
Oct 3, 2016
Messages
673
Reaction score
166
Age
47
Location
Devon, UK
for simple workflow, i use a trimble device on 3 known points on the map which can be seen from images - it doesnt give cm accuracy but i can get x/y to 12cm and z to 12-24cm and it adds about 4 mins to a job
 
Joined
Oct 21, 2016
Messages
3
Reaction score
1
Age
36
Thanks @IrishSights for the workflow, works for me.

I am looking at installing some permanent GCPs and fixing with RTK GPS (using external contractor) at a site that I work where we need to monitor bulk stocks frequently. I am getting at best around 1.5m total error just using inbuilt GPS. Would be interested in the trimble device used by @bluelight.support I have considered the trimble LEAP that you can use with Trimble ViewPoint RTX to get sub 1m accuracy. Does anyone have any experience with one?

Thanks
 
Joined
Oct 3, 2016
Messages
673
Reaction score
166
Age
47
Location
Devon, UK
...plus the cost of a trimble device :). What model?
Trimble Geo 6000 XH with CM accuracy module, then post processed with Pathfinder Office. You can pick them up off eBay for around £3k. Using on site with a simple hold and click for 20-30 seconds per point gives you sub foot accuracy. Using a pole and external antenna on each point for around 5 mins per point gives you CM accuracy, or using an RTK sim card and service gives you cm accuracy within seconds.

I looked at the Leap unit but its not good enough for survey work.

There is a new 3D Robotics RTK system coming out called HERE which should be available nowish, which is around £500, I am looking at that with a Pixhawk 2 as a system from Europe which takes images every 2 seconds, but will take the lat, long and altitude via the pixhawk 2 (and HERE) and put it directly into the EXIF info of the image, and that will be 1-2cm accuracy direct on the UAV so as simple workflow as possible, giving 1-2cm accuracy - should be an absolute game changer!
 
Last edited:
  • Like
Reactions: AerialVisions
Joined
Jan 14, 2014
Messages
2,043
Reaction score
491
Location
Bangor, Northern Ireland, UK
Website
irishsights.com
Trimble Geo 6000 XH with CM accuracy module, then post processed with Pathfinder Office. You can pick them up off eBay for around £3k. Using on site with a simple hold and click for 20-30 seconds per point gives you sub foot accuracy. Using a pole and external antenna on each point for around 5 mins per point gives you CM accuracy, or using an RTK sim card and service gives you cm accuracy within seconds.

I looked at the Leap unit but its not good enough for survey work.

There is a new 3D Robotics RTK system coming out called HERE which should be available nowish, which is around £500, I am looking at that with a Pixhawk 2 as a system from Europe which takes images every 2 seconds, but will take the lat, long and altitude via the pixhawk 2 (and HERE) and put it directly into the EXIF info of the image, and that will be 1-2cm accuracy direct on the UAV so as simple workflow as possible, giving 1-2cm accuracy - should be an absolute game changer!
I think One Button Survey (OBS) will be a game changer if it gets the backing. They say it will even if Kickstarter targets are not met. One Button Survey (OBS). There is also a really good discussion thread with the developers over on RCgroups.


UK PFAW holder
BNUC-S qualified
 
Joined
Oct 3, 2016
Messages
673
Reaction score
166
Age
47
Location
Devon, UK
I have spoken to them actually and I fully agree - however that is some time away and when i spoke to them last year they were hoping to have it launched before now, so in the short to medium term its not going to be around yet.

It will be nice when technology finally catches up so the likes of Trimble, etc dont have the monopoly on these !
 
Joined
Oct 21, 2016
Messages
3
Reaction score
1
Age
36
Just to add to the original post if you run this script in photoscan pro

import PhotoScan

doc = PhotoScan.app.document
chunk = doc.chunk

for camera in chunk.cameras:
if "DJI/RelativeAltitude" in camera.photo.meta.keys() and camera.reference.location:
z = float(camera.photo.meta["DJI/RelativeAltitude"])
camera.reference.location = (camera.reference.location.x, camera.reference.location.y, z)

chunk.updateTransform()
PhotoScan.app.update()
print("Script finished")

It will do the same thing as the original post within photoscan and if you want to add the height AMSL at take off point run this script below

import PhotoScan

alt = PhotoScan.app.getFloat("Please specify the height in meters to be added:", 100)

doc = PhotoScan.app.document
chunk = doc.chunk

for camera in chunk.cameras:
if camera.reference.location:
coord = camera.reference.location
camera.reference.location = PhotoScan.Vector([coord[0], coord[1], coord[2] + alt])

chunk.updateTransform()
PhotoScan.app.update()
print("Script finished")

I found that this speeds things up a bit and I always had a few snags with the EXIFTool.

Where I got the info from Altitude from EXIF in DJI Phantom 3 is negative

Hope it helps anyone else.
 
  • Like
Reactions: IrishSights
Joined
Sep 21, 2018
Messages
1
Reaction score
0
Age
34
Hello,

Sorry to jump on this old post but it seems like the fix to my issue.

I have created a DSM from the images captured by my Phantom 4 Pro however the values are ~60m when they should be ~110m. If i add the GPS height of the home point to the relative values will it improve the DSM or do i need the barometric altitude from an app?

Why are the values so off, will i need to capture GCPs next time i do this?

Thank you for any advice.
 

New Threads

Forum statistics

Threads
19,043
Messages
187,462
Members
27,997
Latest member
nsriar