Click here to Skip to main content
11,923,517 members (67,183 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


4 bookmarked

Extracting Exif Coordinate From Geotagged Photo

, 24 Jul 2014 CPOL
Rate this:
Please Sign up or sign in to vote.
Reading Exif coordinates from image for Windows phone 8


This tip shows you how to read Exif coordinates from image for Windows phone 8.

I have gone round and round trying to find a plug and play solution for reading exif information from every corner of the internet and by reading the few books I have access to without much success.

I decided to come up with my own plug and play version of an exif reader, thanks to the C# implementation of an EXIF Library available on CodeProject, by Tim Heuer(Good Man!). Works well for both Windows Phone 7 and 8.

So I combined the foundational work by Igor Ralic and Colin Eberhardt to create this simple class for accessing geocode information from images.

So accessing Exif data has never been a piece of cake with this awesome one liner call to the JpegInfo class.

JpegInfo info = ExifLib.ExifReader.ReadJpeg(e.ChosenPhoto, e.OriginalFileName);

The JpegInfo provides direct access to the exif data which you can create your own objects for storing the data and use how you want! I know you are crazy with the blah blah blah – so here is the code:

        void task_Completed(object sender, PhotoResult e)
            if (e.TaskResult == TaskResult.OK)
                photoLoaded = true;
                JpegInfo info = ExifLib.ExifReader.ReadJpeg(e.ChosenPhoto, e.OriginalFileName);
                var img = new BitmapImage();
                loadedImg.Source = img;
        private static double DecodeLatitude(JpegInfo info)
            double degrees = ToDegrees(info.GpsLatitude);
            return info.GpsLatitudeRef == ExifGpsLatitudeRef.North ? degrees : -degrees;

        private static double DecodeLongitude(JpegInfo info)
            double degrees = ToDegrees(info.GpsLongitude);
            return info.GpsLongitudeRef == ExifGpsLongitudeRef.East ? degrees : -degrees;

        public static double ToDegrees(double[] coord)
            return coord [0] + coord [1] / 60.0 + coord [2] / (60.0 * 60.0);
        private void ReadExif(JpegInfo info)
            var Lat = 0.0;
            var Long = 0.0;
            // check if we have co-ordinates
            if (info.GpsLatitude.First() != 0.0)
                    Lat = DecodeLatitude(info);
                    Long = DecodeLongitude(info);

Something this like has never been easier to find. And there you go. Plug and play it in your own code and let me know how it goes. You can contact me at and my blog


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

United States United States
No Biography provided

You may also be interested in...

Comments and Discussions

-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.151125.3 | Last Updated 24 Jul 2014
Article Copyright 2014 by Yustto
Everything else Copyright © CodeProject, 1999-2015
Layout: fixed | fluid