Permalink
Browse files

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

…o account the N/E/S/W references
  • Loading branch information...
1 parent 1d0a2a0 commit 1911eff333f7498b8a8de22c3d27e413889d8572 @arnaud arnaud committed Jul 19, 2011
Showing with 6 additions and 2 deletions.
  1. +6 −2 lib/jpeg.rb
View
@@ -61,15 +61,19 @@ def gps_lat
if self.gps_latitude.nil? or self.gps_latitude.length < 2
nil
else
- self.gps_latitude[0].to_f+self.gps_latitude[1].to_f/60+self.gps_latitude[2].to_f/3600
+ value = self.gps_latitude[0].to_f+self.gps_latitude[1].to_f/60+self.gps_latitude[2].to_f/3600
+ value = -value if self.gps_latitude_ref.to_s == "S"
+ value
end
end
def gps_lng
if self.gps_longitude.nil? or self.gps_longitude.length < 2
nil
else
- self.gps_longitude[0].to_f+self.gps_longitude[1].to_f/60+self.gps_longitude[2].to_f/3600
+ value = self.gps_longitude[0].to_f+self.gps_longitude[1].to_f/60+self.gps_longitude[2].to_f/3600
+ value = -value if self.gps_longitude_ref.to_s == "W"
+ value
end
end

0 comments on commit 1911eff

Please sign in to comment.