MATLAB Answers

0

Issue in reading GPS info from JPG images ?

Asked by Ahsan Abbas on 29 Jan 2017
Latest activity Commented on by Walter Roberson
on 2 Feb 2017
I have some JPG images that are Geo-Tagged, am trying to read Lat & Long information from them in (Deg,Min,Sec) and want to convert them in decimal degree(DD), but getting some issue, My code is as follow
info = imfinfo('DSC_0011.JPG');
The result of above statement is as follow
**nfo.GPSInfo**
GPSVersionID: [2 3 0 0]
GPSLatitudeRef: 'N'
GPSLatitude: [33 34.2657 0]
GPSLongitudeRef: 'E'
GPSLongitude: [73 8.5707 0]
GPSAltitudeRef: 0
GPSAltitude: 456
GPSTimeStamp: [5 5 48.6400]
GPSSatellites: '05'
GPSMapDatum: 'WGS-84'
GPSDateStamp: '2016:03:31'
As you can see from above result in both rows Lat & Long seconds are 0, but in actually when i checked the properties of corresponding image it was this:
can some one help me to resolve the issue, i am facing same error while reading different images...

  4 Comments

Show 1 older comment
34 minutes 15.941999999999546 second is 34.2657 minutes to within eps() of that value range. So just do the usual
seconds = (minutes - floor(minutes)) * 60
minutes = floor(minutes)
Yes but he may need more accurate than that. Even though there's a 4 meter accuracy in GPS, 1e-16 times the circumference of the earth is 4 nanometers. What if he needs to specify his location down to the nearest angstrom? ;-)
Even if the position were represented in one double (instead of being split into degrees and minutes+fractions),
eps(40075)
ans =
7.27595761418343e-12
and angstrom is 10^10, so double is already capable of representing down to about 1/13th of an angstrom.

Sign in to comment.

2 Answers

Answer by Image Analyst
on 29 Jan 2017
 Accepted Answer

What did you use for the second method of getting GPS info? Why not just take the fractional part and multiply by 60 to get seconds:
secs = 0.2657 * 60; % = 15.942 seconds
It will give you the same number of seconds. What's wrong with doing that, if anything?

  1 Comment

I just checked the property of image and it provided me the complete GPS information, but thanks for helping...

Sign in to comment.


Answer by Walter Roberson
on 29 Jan 2017

Take the seconds mod 1 and multiply that by 60

  1 Comment

Thanks for help, got it...

Sign in to comment.