module ExifWeather
Constants
- VERSION
Public Class Methods
weather( file )
click to toggle source
Get weather information via openweathermap.org/ @param [String] file the JPEG image file with GPS information. @return [Hash] weather information.
# 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