Extracting tags from libraw_gps_info_t

Hi,

So, I am trying to extract the information from the tag longref, altref, etc. longref should be chars either E or W, but if I access it by libraw I am getting some weird characters, I am accessing it via imgdata.other.parsed_gps.longref What might be the issue?

--KaroTK

Forums: 

Sample

I can't find a way to attach a file, but here is a sample code that fails. I an extracting a lot of information so I am putting everything into a stream.

#include "libraw/libraw.h"
#include < iostream >
#include < sstream >

void getGPSinfo(string fileName)
{
LibRaw proc;
FILE *pf;
ostringstream stream;
proc.open_file(fileName);

libraw_gps_info_t GPSInfo = proc.imgdata.other.parsed_gps;

stream << "\"GPSAltitudeRef\"" << "->" << to_string(GPSInfo.altref);

pf = fopen("somePath\\debug.txt", "w");
fprintf(pf, stream.str().c_str());
fclose(pf);
proc.recycle();

}

I sent a project to your

I sent a project to your email. Please note that checkMetadataValue is written so, that if the value is absent then it should return "Missing", also note that even though it extracts altitude, after failing to extract longref it stops and does nothing with the rest of the file.

Also, I am concerned about other fields in GPS, for instance longitude returns 0s no matter what image I try.

The only things I need is the

The only things I need is the RAW file to see is LibRaw correctly parses GPS fiield or not.

-- Alex Tutubalin @LibRaw LLC

BTW no message(s) in inbox

BTW no message(s) in inbox yet.....

Please use some file sharing service because E-mail providers/servers may limit message size

-- Alex Tutubalin @LibRaw LLC

Okay, I'll upload another one

Okay, I'll upload another one soon. However how does LibRaw handle these cases? I mean if the tag is absent and I try to access its contents what is the expected result? Or better yet, is there a good way of checking it?

imgdata.other.gpsdata

imgdata.other.parsed_gps.gpsparsed is non-zero if gps data has parsed.

-- Alex Tutubalin @LibRaw LLC

Parsing of LibRaw GPS data

Parsing of LibRaw GPS data doesn't seem to match EXIF

RAW_PENTAX_K20D.PEF
http://www.rawsamples.ch/raws/pentax/k20d/RAW_PENTAX_K20D.PEF
LibRaw parsed_gps: ((0, 48, 7), (48.3039855957031, 11, 34), (2.32399201393127, 18, 14), 50, '3', 'S', #20, 'D', #0)
EXIF:
GPS Version ID : 2.2.0.0
GPS Latitude Ref : North
GPS Latitude : 48.130084°
GPS Longitude Ref : East
GPS Longitude : 11.567312°
GPS Altitude Ref : Above Sea Level
GPS Altitude : 593.3 m
GPS Time Stamp : 18:14:50
GPS Satellites : 0
GPS Map Datum : WGS-84
GPS Date Stamp : 2008:05:08

RAW_SONY_SLTA65V.ARW
http://www.rawsamples.ch/raws/sony/RAW_SONY_SLTA65V.ARW
LibRaw parsed_gps: ((0, 45, 35), (39.9160003662109, 9, 13), (40.5859985351562, 17, 54), 50, '=', #10, '4', 'C', #0)
EXIF:
GPS Version ID : 2.3.0.0
GPS Latitude Ref : North
GPS Latitude : 45.594421°
GPS Longitude Ref : East
GPS Longitude : 9.227941°
GPS Altitude Ref : Above Sea Level
GPS Altitude : 180.04 m
GPS Time Stamp : 17:54:50
GPS Status : Measurement Active
GPS Measure Mode : 3-Dimensional Measurement
GPS Dilution Of Precision : 1.5647
GPS Speed Ref : km/h
GPS Speed : 0.145
GPS Track Ref : True North
GPS Track : 209.84
GPS Map Datum : WGS-84
GPS Date Stamp : 2012:01:04
GPS Differential : No Correction

According to Exiftool for

According to Exiftool for your 1st file:
GPS Latitude : 48 deg 7' 48.30" N
GPS Longitude : 11 deg 34' 2.32" E
According to LibRaw (variables from MSVC Debugger):
+ latitude 0x0000016e11b1f0cc {48.0000000, 7.00000000, 48.3039856} float[3]
+ longitude 0x0000016e11b1f0d8 {11.0000000, 34.0000000, 2.32399201} float[3]

I do not see any difference.

It is likely that your '(0, 48, 7)' is lattitude array dump (1st 3-item array in parsed_gps structure), it looks like offsets used (either in parsing or in interpreting the data) are wrong.
Please make sure you use libraw*.h and libraw*so (.a) from the same version (so assume same structures offset).
Another possible problem is structure padding (different assumption in calling code and in compiled LibRaw)

-- Alex Tutubalin @LibRaw LLC

Thank you

Thank you