Workaround for Missing GPS tags on DNG Files

Intrepid00

New member
Sep 30, 2013
50
0
0
Many of you using DNG have noticed like me that the DNGs are missing the GPS encoding that the 5MP JPG has. This workaround makes use of the ExifTool by Phil Harvey and Microsoft's Powershell to help quickly tag DNGs using the JPGs uploaded to your OneDrive Camera Roll (accessed via local folder path).

The following is the ps1 script that you run from the same directory where you save the ExifTool. Don't forget to remove the (-k) tag from the filename of the ExifTool.exe it has by default.
Code:
#Set the varibles below leaving the apostrophes

#Set the $CameraRoll to the file folder path to your OneDrive Camera Roll Path
$CameraRollPath = 'D:\SkyDrive\Pictures\Camera Roll\'
#Set this to where you have your DNGS saved. THESE MUST BE LOCAL DRIVE (not Phone) AND IF ONEDRIVE FOLDER OFFLINE ACCESS
$DngsPath = 'D:\Skydrive\Pictures\DNG'

$Dngs = Get-ChildItem $DngsPath -Filter *.dng

foreach ($dng in $Dngs)
{
    $SourceJpg = $CameraRollPath + $dng.Name.Replace('__highres.dng', '.jpg')
        
    .\exiftool.exe -TagsFromFile $SourceJpg -GPSLatitude -GPSLatitudeRef -GPSLongitude -GPSLongitudeRef -GPSAltitude -GPSAltitudeRef  $dng.FullName
}

I know this isn't exactly easy to use if you don't know PowerShell (or scripting at all) but for those that do understand it here is a nice fix I made quickly. You might be able to use just the ExifTool as well without PowerShell if you spend the time to read its documentation. If there is enough interest I'll spend the time to write a How To use this.
 

Salem874

New member
Dec 16, 2012
61
0
0
Excellent, thanks for sharing...

If only Microsoft/Nokia added GPS info to the DNGs by default
 

CernT

New member
May 12, 2014
33
0
0
That should be now fixed with latest Denim Update. Is there any Windows phone App where you can see the gps taggs in the dng file (i.e. Rawer doesn't )?

Edit: It's not fixed in my new firmware version 3051.50009.1451.1001
 
Last edited:

nickisverygood

New member
Feb 28, 2014
29
0
0
For people using python
make sure putting exiftool.exe in the same folder with this script

import os
import subprocess
path = "I:\\trip"
for root,dirs,files in os.walk(path):
for file in files:
if "highres" in file:
name,ext =os.path.splitext(os.path.join(root,file))
if ext == "dng" or "DNG":
name,ext =os.path.splitext(os.path.join(root,file))
A=os.path.join(root,file)
sA=file
if os.path.isfile(os.path.join(root,sA.replace("__highres.dng",".jpg"))):
B =os.path.join(root,sA.replace("__highres.dng",".jpg"))
sB = sA.replace("__highres.dng",".jpg")
print("------------------------------")
print("DNG path: "+A)
print("DNG name: "+sA)
print("Oversampled JPG path: "+B)
print("Oversampled JPG name: "+B)
print("------------------------------")
subprocess.call("exiftool.exe -TagsFromFile "+"\""+B+"\""+" -GPSLatitude -GPSLatitudeRef -GPSLongitude -GPSLongitudeRef -GPSAltitude -GPSAltitudeRef -DateTimeOriginal "+"\""+A+"\"")
 

Forum statistics

Threads
331,378
Messages
2,254,233
Members
428,698
Latest member
jones