Has anyone successfully read GPS data using WPFs class BitmapMetadata
which internally uses WIC (Windows Imaging Component)?
I have an image where both Windows (8.1) Explorer and external tools like XnView show GPS coordinates.
I try to extract these data using the class BitmapMetadata
which is available via property Metadata
of class BitmapFrame
:
var md = (BitmapMetdata)extractedFrame.Metadata;
var altitude = md.GetQuery("System.GPS.Altitude");
var altitudeProxy = md.GetQuery("System.GPS.Altitude.Proxy");
var altitudeRef = md.GetQuery("System.GPS.AltitudeRef");
var longitude = md.GetQuery("System.GPS.Longitude");
var longitudeProxy = md.GetQuery("System.GPS.Longitude.Proxy");
var longitudeRef = md.GetQuery("System.GPS.LongitudeRef");
var latitude = md.GetQuery("System.GPS.Latitude");
var latitudeProxy = md.GetQuery("System.GPS.Latitude.Proxy");
var latitudeRef = md.GetQuery("System.GPS.LatitudeRef");
Results of altitude
(System.Double), altitudeRef
(System.Byte), longitudeRef
(System.String) and latitudeRef
(System.String) are all ok and retrieve reasonable data ("510.70", "0", "N", "E").
longitude
and latitude
should be arrays of System.Double but they are always NULL.
The results using the ".Proxy" suffixes return strange String data of which I am not shure how they are to be parsed and if they are culture invariant or not: The MSDN docs tell something different, nothing about strings; but at least there would be "valid" data for Longitude and Latitude there.
Is it a bug or my fault in missing something?