.netvb.netgpsexifgeotagging

How do I convert these image EXIF GPS coordinates into Decimal Lat/Lng?


I'm writing some image processing code, and I'm pulling out the GPS coordinates, however they are in some sort of integer array that I can't figure out how to convert to Degree/Minute/Second or Decimal form.

Lat: (38,0,0,0,1,0,0,0,54,0,0,0,1,0,0,0,168,73,5,0,16,39,0,0)
Lng: (77,0,0,0,1,0,0,0,2,0,0,0,1,0,0,0,60,122,0,0,16,39,0,0)

According to windows the D/M/S version of this is:

enter image description here

VB.NET code would be most helpful but I could probably convert it from any language.


Solution

  • Here is code that works in C# using .NET calls (should be trivial to do in VB)

    Double deg = (Double)BitConverter.ToInt32(data,0)/ BitConverter.ToInt32(data,4);
    Double min = (Double)BitConverter.ToInt32(data,8)/ BitConverter.ToInt32(data,12);
    Double sec = (Double)BitConverter.ToInt32(data,16)/ BitConverter.ToInt32(data,20);
    

    The format is documented here http://en.wikipedia.org/wiki/Geotagging