- Notifications
You must be signed in to change notification settings - Fork0
Simplified weather collection
License
slashlos/Weather
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Weather is a series of methods to simplify weather collection to asingle model as dictionary. Supporting various weather providers,an attempt is make to unify the results to a single standard. Seemethod +weatherBySimulation, for the details of the weather model.
The caller passes in a dictionary containing a few args such as
lat, lotlatitude, longitudecccountry codeststate codeloclocation code - weather.com, yahoo!wooedwhere on Earth idowmidopen weather map location id
which are used in the formation of a weather URL which is read, parsedand returned as a dictionary. This is known as the "location" dictionary.From this, various provider routines will choose which argument are required.The caller in addition to the location dictionary, passes in the provider type;see Weather public header for the dictionary model returned.
To use the Weather in an app,
1. drag the Weather project into your project 2. supersede weather keys defined in Weather-Private with your own such as in your applicationDidFinishLaunching: or similar method, do something like//Load our weather keysSETSTR(@"ydnDefKey",@"your-private-key");SETSTR(@"ydnAppKey",@"your-private-key");//Open Weather Map API KeySETSTR(@"owmDefKey",@"your-private-key");SETSTR(@"owmAppKey",@"your-private-key");//WeatherUnderground API keySETSTR(@"wuAppKey",@"your-private-key");
Note that the use of individual weather providers require registration of authentication keys.
See
Yahoo!https://developer.yahoo.com/weather/ (currently NYI, public api used)Open Weather Maphttp://openweathermap.org/apiWeather Undergroundhttps://www.wunderground.com/
In all cases, weather results are unified into a consistent weather results when possible.(i.e., most provides do not provide astrology info)
As of version 0.2, Weather is ARC compliant.
Weather extends NSString and NSDictionary with the following methods:
- (NSString *)URLEncodedString
Address illegal URL characters in string
- (NSString *)weatherStringWithContentsOfURL:(NSURL *)weatherURL;
Read URL into a string - synchronous currently
- (NSURL *)weatherURLBy:(WeatherProvider_t)provider
Return URL by provider using a location dictionary
- (NSString *)locationArgsBy:(WeatherProvider_t)provider
Formulate location args using a location dictionary
- (id)weatherByYahoo:(NSURL *)address
Return weather provided by Yahoo!
- (id)weatherByOpenWeatherMap:(NSURL *)address
Return weather provided by Open Weather Map
- (id)weatherByWeatherUnderground:(NSURL *)address
Return weather provided by Weather Underground
- (id)weatherForBy:(WeatherProvider_t)provider
Return weather provider by provider indicated
- (id)weatherBySimulation
Return a weather model simulation to which all provider results are normalized against:
Weather makes use of the XMLDictionary Framework package found also on github:
https://github.com/danielctull-forks/XMLDictionary-Framework
Version 0.3
- Added weather model and mapping from distinct providers; first pass at using a Soundex Package available at Github Gist:https://gist.github.com/darkseed/1261842, to map weather text strings across providers.
Version 0.2
- Initial release
/los