Advertisement
Madmouse

don't ask me why I needed this

Mar 15th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.73 KB | None | 0 0
  1. import piexif
  2.  
  3.  
  4. # http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf
  5. # GPS INDEX MAP FROM DOCUMENTATION on page 68:
  6.  
  7. rational = lambda x: str(float(x[0]) / float(x[1])
  8. rational_list = lambda x: " ".join([str(float(v[0]) / float(v[1])) for v in x])
  9. integer =  lambda x: str(x)
  10. string = lambda x: x.upper()
  11.  
  12. gps_tag_map = {
  13.     0:  ("Gps_Version", lambda x: ".".join([str(v) for v in x])),
  14.     1:  ("Gps_Latitude_Reference", string),
  15.     2:  ("Gps_Latitude", rational_list),
  16.     3:  ("Gps_Longitude_Reference", string),
  17.     4:  ("Gps_Longitude", rational_list),
  18.     5:  ("Gps_Altitude_Reference", integer),
  19.     6:  ("Gps_Altitude", rational),
  20.     7:  ("Gps_Timestamp", rational_list),
  21.     8:  ("Gps_Satelites", string),
  22.     9:  ("Gps_Status", string),
  23.     10: ("Gps_Measure_Mode", string),
  24.     11: ("Gps_DOP", rational),
  25.     12: ("Gps_Speed_Reference", string),
  26.     13: ("Gps_Speed", rational),
  27.     14: ("Gps_Track_Reference", string),
  28.     15: ("Gps_Track", rational),
  29.     16: ("Gps_Image_Direction_Reference", string),
  30.     17: ("Gps_Image_Direction", rational),
  31.     18: ("Gps_Map_Datum", string),
  32.     19: ("Gps_Destination_Latitude_Reference", string),
  33.     20: ("Gps_Destination_Latitude", rational_list),
  34.     21: ("Gps_Destination_Longitude_Reference", string),
  35.     22: ("Gps_Destination_Longitude", rational_list),
  36.     23: ("Gps_Destination_Bearing_Reference", string),
  37.     24: ("Gps_Destination_Bearing", rational),
  38.     25: ("Gps_Destination_Distance_Reference", string),
  39.     26: ("Gps_Destination_Distance", rational),
  40.     27: ("Gps_Processing_Method", string),
  41.     28: ("Gps_Area_Information", string),
  42.     29: ("Gps_Datestamp", string),
  43.     30: ("Gps_Diferential", integer),
  44.     31: ("Gps_Positioning_Error", rational)
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement