Reading GPS data from JPEG image in WPF app windows 8.1 RRS feed

  • Question

  • Hi,

    I am developing a Windows 8.1 application using c# xaml wherein I am trying to extract latitude and longitude information from a JPEG image. I am not able extract this information. The code is as given below. please advise. Thanks you..

    var stream = await file.OpenAsync(Windows.Storage.FileAccessMode.Read); var bitmapImage = new Windows.UI.Xaml.Media.Imaging.BitmapImage(); await bitmapImage.SetSourceAsync(stream); myImage.Source = bitmapImage; var decoder = await Windows.Graphics.Imaging.BitmapDecoder.CreateAsync(stream); requests.Add("System.GPS.Latitude");

    var retrievedProps =await decoder.BitmapProperties.GetPropertiesAsync(requests);

    ushort latitude;

    if (retrievedProps.ContainsKey("System.GPS.Latitude"))


    latitude = (ushort)retrievedProps["System.GPS.Latitude"].Value;

    latitudetxt.Text =Convert.ToString(latitude); }

    Friday, May 2, 2014 8:55 PM


  • Hi,

    You can refer to some codes below:

    m_imageProperties = await file.Properties.GetImagePropertiesAsync();
                    string[] requests =
                    IDictionary<string, object> retrievedProps =
                        await m_imageProperties.RetrievePropertiesAsync(requests);
     if (retrievedProps.ContainsKey("System.GPS.Latitude"))        
                    latitude= ((ushort)retrievedProps["System.GPS.Latitude"]).ToString();
      if (retrievedProps.ContainsKey("System.GPS.Longitude"))
                    fNumberText = ((ushort)retrievedProps["System.GPS.Longitude"]).ToString();

    And you can refer to the sample below:


    In the Scenario1_ImageProperties.xaml.cs file there are two methods you can refer to get the image file GPS data:



    Best Wishes!

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey. Thanks<br/> MSDN Community Support<br/> <br/> Please remember to &quot;Mark as Answer&quot; the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.

    • Marked as answer by Anne Jing Monday, May 12, 2014 9:08 AM
    Monday, May 5, 2014 2:51 AM