Home > GoogleWeather

GoogleWeather

GoogleWeather is a project mainly written in ..., based on the View license.

Google Weather Ruby Gem

== GoogleWeather

This is a gem which produces a class which can be used to retrieve a forecast from Google Weather. The Google Weather API is undocumented, but has been pretty stable for the last 2 years. No guarantees that google won't change the way this api works, or make it unuseable by the overall public. Until then, happy forecasting!

Usage

forecast = GoogleWeather.forecast("San Francisco, CA") puts forecast.inspect

{:current=>{ :conditions=>\"Partly Cloudy\", :temp_f=>\"52\", :temp_c=>\"11\", :humidity=>\"Humidity: 81%\", :wind=>\"Wind: NW at 1 mph\" }, :location=>{ :postal_code=>\"San Francisco, CA\", :latitude=>\"\", :longitude=>\"\", :forecast_date=>\"2011-01-18\", :current_date_time=>\"2011-01-19 03:51:37 +0000\", :city=>\"San Francisco, CA\" }, :future=>{ \"Wed\"=>{ :conditions=>\"Partly Cloudy\", :low_f=>\"47\", :high_f=>\"61\"}, \"Thu\"=>{ :conditions=>\"Sunny\", :low_f=>\"49\", :high_f=>\"62\"}, \"Tue\"=>{ :conditions=>\"Partly Cloudy\", :low_f=>\"50\", :high_f=>\"57\"}, \"Fri\"=>{ :conditions=>\"Sunny\", :low_f=>\"49\", :high_f=>\"62\"} }}

The google forecast can also be done by latitude and longitude using: GoogleWeather.forecast(:lat => 37.775,:long => -122.4183333)

NOTES:

-When you look at the returned forecast, the latitude and longitude will have been multiplied by 1M. -Point forecasts (lat & long) are NOT the same as AREA forecasts. In the examples above, I use San Francisco, and 37.775, -122.418333 the latter is the city center of SF. These are not guaranteed to return the same current conditions as there may be multiple weather stations giving information.

Previous:tic-tac-toe