I am trying to extract the GPS location information from Nikon D850 NEF files. The GPS information was written to the NEF file by ViewNX-i (version 1.3.0), and appears to be correct.
The only GPS tag that I can extract is GPSVersionID which has the value "2 3 0 0".
I am extracting the information in R using the package "exifr", which is using version 11.22 of ExifTool, which is running under Windows 8.1 (64 bits). From the documentation, the package calls ExifTool with the arguments -n -j -q. The package requires Perl, and I am using version 5.26.3 of ActivePerl
Can you run exiftool -a -G0:1 on the file and show us the output? That way we can verify whether or not there is any gps data in the file. From there we can figure out what can be done to get the GPS info where/how you want it.
A Nikon D850 by itself doesn't store GPS position.
- Phil
Quote from: Phil Harvey on April 22, 2019, 07:02:16 AM
A Nikon D850 by itself doesn't store GPS position.
- Phil
Phil, he said that he used the Nikon view nx-i to write the gps data.
Ah, thanks.
Nikonviewnx-i does not write to the photo, it writes to a sidecar file under the ./NKSC_PARAM/ directory.
exiftool does show some stuff from the sidecar file. For example:
Appname : ViewNX-i
GPS Version ID : AgMAAA==
GPS Version ID Type : Binary
GPS Latitude Ref Type : Long
GPS Latitude : AAAAAAAAREAAAAAAAIBJQAAAAGDpizdA
GPS Latitude Type : Double
GPS Longitude Ref Type : Long
GPS Longitude : AAAAAAAALEAAAAAAAAAuQAAAAICFyE1A
GPS Longitude Type : Double
GPS Map Datum : WGS-84
GPS Map Datum Type : Ascii
Phil, if it is of any use, the sidecar file is attached, from a D7000, with location data inserted using nikonviewnxi by dropping a pin on the map.
@HarryEC123
If you convert the nef to a jpg with viewnx-i, you will be able to extract the location data from the .jpg.
Thanks Alan,
Wow, that is odd. Storing the values as base64-encoded binary doubles. Weird. Anyway, I have included a config file that will allow you to read these values directly from the viewnx sidecar file. The only trick is that you must ignore the Composite GPSLatitudeRef/GPSLongitudeRef tags, and use the XMP-ast versions instead.
- Phil
Edit: Tweaked config file (by pretending that the tags are in the GPS instead of XMP group) to work with the existing Composite tags. (So you don't have to ignore the Composite reference direction tags, and the signed coordinates are now available.)
Interesting, the coordinates and e.g. ID are all in BASE64 encoding, for the coordinates we then need to find out how they are saved, but from the data it looks like they are stored as (a number of) (64 bit?) doubles, what coordinates did you specify? That way it should be easier to see how they are stored.
Update: I see Phil already provided a config file to help here. So is looks like the coordinates are 40°51'23.5465297698875, 14°15'59.5665740966815. Does that seem correct (it's in Naples)?
Cheers,
Hayo
Quote from: Hayo Baan on April 22, 2019, 09:05:50 AM
(it's in Naples)?
Cheers,
Hayo
Yes. Although it's only a copy in a temp directory, I put it in more or less the correct location.
It would be good to know if I got the reference directions correct. I didn't have samples from the western or southern hemispheres, so I had to guess at the numerical values for these.
- Phil
I've marked a photo as being in Grytviken with nikonviewnxi. Sidecar file attached. Also attached is a small jpg created by nikonviewnxi that contains the location data.
Alan,
Thanks! I guessed right. South is 1, and West is 3.
However, the Composite tags aren't picking this up properly because the "numerical" values are different than EXIF GPS.
- Phil
Converting the NEF file to a JPG enabled the following GPS fields to be extracted
GPSVersionID
GPSLatitudeRef
GPSLongitudeRef
GPSAltitudeRef
GPSMapDatum
GPSAltitude
GPSLatitude
GPSLongitude
GPSPosition
So whilst a work around, it is rather a slow process to convert a large number of files.
Would an example NEF file help with known GPS parameters?
As Alan said, the GPS is not in the NEF, so a sample won't help.
- Phll
Enclosed is an example nksc file where the GPS information is stored.
ExifTool can read the file, and identifies the fields correctly, but not the formatting. For example, GPSPosition returns
"AAAAAACAQ0AAAAAAAIBDQAAAAKC/i0xA AAAAAAAAM0AAAAAAAABHQAAAAOBHYDtA"
See the config file that I posted earlier in this thread.
- Phil
Having experienced this problem as well, and faced with the prospect of having to fix several hundred files by hand, I wrote a small open source windows CLI program (https://github.com/a-roach/nkscgeosync (https://github.com/a-roach/nkscgeosync)) to automate the process. As a bonus, the program also lets you set various noise reduction settings en-mass.
Note that the current version of ExifTool does decode GPS from NKSC files. The config file is no longer necessary.
- Phil