Module: ExifWeather
- Defined in:
- lib/exif_weather.rb
Class Method Summary collapse
-
.weather(file) ⇒ Hash
Get weather information via openweathermap.org/.
Class Method Details
.weather(file) ⇒ Hash
Get weather information via openweathermap.org/
11 12 13 14 15 16 17 18 19 |
# File 'lib/exif_weather.rb', line 11 def self.weather( file ) e = EXIFR::JPEG.new(file) return nil unless e.gps lat = e.gps.latitude lon = e.gps.longitude return nil if lat.nil? or lon.nil? res = open("http://api.openweathermap.org/data/2.5/weather?lat=#{lat}&lon=#{lon}").read return JSON.parse(res) end |