Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixes the GPS latitude and longitude values so that they now take int…

…o account the N/E/S/W references
  • Loading branch information...
commit 1911eff333f7498b8a8de22c3d27e413889d8572 1 parent 1d0a2a0
Arnaud Leymet authored July 19, 2011

Showing 1 changed file with 6 additions and 2 deletions. Show diff stats Hide diff stats

  1. 8  lib/jpeg.rb
8  lib/jpeg.rb
@@ -61,7 +61,9 @@ def gps_lat
61 61
       if self.gps_latitude.nil? or self.gps_latitude.length < 2
62 62
         nil
63 63
       else
64  
-        self.gps_latitude[0].to_f+self.gps_latitude[1].to_f/60+self.gps_latitude[2].to_f/3600
  64
+        value = self.gps_latitude[0].to_f+self.gps_latitude[1].to_f/60+self.gps_latitude[2].to_f/3600
  65
+        value = -value if self.gps_latitude_ref.to_s == "S"
  66
+        value
65 67
       end
66 68
     end
67 69
 
@@ -69,7 +71,9 @@ def gps_lng
69 71
       if self.gps_longitude.nil? or self.gps_longitude.length < 2
70 72
         nil
71 73
       else
72  
-        self.gps_longitude[0].to_f+self.gps_longitude[1].to_f/60+self.gps_longitude[2].to_f/3600
  74
+        value = self.gps_longitude[0].to_f+self.gps_longitude[1].to_f/60+self.gps_longitude[2].to_f/3600
  75
+        value = -value if self.gps_longitude_ref.to_s == "W"
  76
+        value
73 77
       end
74 78
     end  
75 79
       

0 notes on commit 1911eff

Please sign in to comment.
Something went wrong with that request. Please try again.