Using piexif I got the DMS of Latitude and longitude which I am trying to convert in decimal degree, but for some images I am getting lattitude value as 184.62583333333333 which is out of the [-90,90] range.
check out the code below,
exif_dict = piexif.load('images/DJI_0026.JPG')
long = 0
latt = 0
value = exif_dict['GPS']
if value:
lat = value[2]
lon = value[4]
for i in range(3):
if i == 1:
latt += lat[i][0]/60.0
elif i == 2:
latt += lat[i][0]/3600.0
else:
latt += lat[i][0]
for i in range(3):
if i == 1:
long += lon[i][0]/60.0
elif i == 2:
long += lon[i][0]/3600.0
else:
long += lon[i][0]
print(latt, long)
value = {0: (2, 3, 0, 0), 1: b'N', 2: ((19, 1), (8, 1), (595773, 10000)), 3: b'E', 4: ((73, 1), (0, 1), (131775, 10000)), 5: 0, 6: (70989, 1000)}
I am concerned with latitude and longitude, that is stored in value of key 2 and 4.
latitude = 19+8/60.0+595773/3600.0
longitude = 73+0/60.0+131775/3600.0
that is what the output is.
OutPut: 184.62583333333333 109.60416666666666
Please let me know how to normalise the latitude in the range of [-90,90].