Extension:Wunderground

What can this extension do?
If supplied with location data it will return a JSON stream of various weather data. This extension creates the tag, it takes various arguments e.g This arg can then be used to push to wunderground to return weather data based on this location.

See http://www.wunderground.com/weather/api/d/documentation.html for specifics of what you can push to wunderground.

Usage
In this case I am using ICAO codes for airport data, this is passed to wunderground as non ambiguous location data. Cities, Lat/Long and others can also be used. See Docs above adn note slight change of URL ebing called. " /q/"airport" vs "/q/STATE/CITY"

YOU WILL NEED TO APPLY FOR AN API KEY. It takes 2 minutes and is free. Here

Download instructions
Please cut and paste the code found below and place it in. Note: $IP stands for the root directory of your MediaWiki installation, the same directory that holds LocalSettings.php.

Installation
To install this extension, add the following to LocalSettings.php:

Configuration parameters
The JSON stream returns the following structure of data (sample data included): object(stdClass)#176 (3) { ["response"]=> object(stdClass)#175 (3) { ["version"]=> string(3) "0.1" ["termsofService"]=> string(52) "http://www.wunderground.com/weather/api/d/terms.html" ["features"]=> object(stdClass)#177 (2) { ["geolookup"]=> int(1) ["conditions"]=> int(1) } }

["location"]=> object(stdClass)#178 (17) { ["type"]=> string(8) "INTLCITY" ["country"]=> string(2) "CI" ["country_iso3166"]=> string(2) "CN" ["country_name"]=> string(5) "China" ["state"]=> string(2) "HK" ["city"]=> string(23) "Hong Kong International" ["tz_short"]=> string(3) "HKT" ["tz_long"]=> string(14) "Asia/Hong_Kong" ["lat"]=> string(11) "22.30888939" ["lon"]=> string(12) "113.91471863" ["zip"]=> string(5) "00000" ["magic"]=> string(1) "4" ["wmo"]=> string(5) "45007" ["l"]=> string(20) "/q/zmw:00000.4.45007" ["requesturl"]=> string(26) "global/stations/45007.html" ["wuiurl"]=> string(54) "http://www.wunderground.com/global/stations/45007.html" ["nearby_weather_stations"]=> object(stdClass)#179 (2) { ["airport"]=> object(stdClass)#180 (1) { ["station"]=> array(4) { [0]=> object(stdClass)#181 (6) { ["city"]=> string(32) "Hong Kong Inter-National Airport" ["state"]=> string(0) "" ["country"]=> string(9) "Hong Kong" ["icao"]=> string(4) "VHHH" ["lat"]=> string(11) "22.33333206" ["lon"]=> string(12) "114.18333435" }

[1]=> object(stdClass)#182 (6) { ["city"]=> string(9) "Hong Kong" ["state"]=> string(0) "" ["country"]=> string(2) "CI" ["icao"]=> string(4) "VHHH" ["lat"]=> string(11) "22.30999947" ["lon"]=> string(12) "113.91000366" }

[2]=> object(stdClass)#183 (6) { ["city"]=> string(8) "Shenzhen" ["state"]=> string(0) "" ["country"]=> string(2) "CI" ["icao"]=> string(4) "ZGSZ" ["lat"]=> string(11) "22.54999924" ["lon"]=> string(12) "114.09999847" } [3]=> object(stdClass)#184 (6) { ["city"]=> string(5) "Taipa" ["state"]=> string(0) "" ["country"]=> string(2) "MU" ["icao"]=> string(4) "VMMC" ["lat"]=> string(11) "22.17000008" ["lon"]=> string(12) "113.56999969" } } }

["pws"]=> object(stdClass)#185 (1) { ["station"]=> array(6) { [0]=> object(stdClass)#186 (7) { ["neighborhood"]=> string(20) "Tai O, Lantau Island" ["city"]=> string(9) "Hong Kong" ["state"]=> string(5) "HKSAR" ["country"]=> string(5) "CHINA" ["id"]=> string(9) "IHKSARHO2" ["distance_km"]=> int(8) ["distance_mi"]=> int(4) } [1]=> object(stdClass)#187 (7) { ["neighborhood"]=> string(30) "APRSWXNET Discovery College HK" ["city"]=> string(9) "Hong Kong" ["state"]=> string(2) "HK" ["country"]=> string(2) "CI" ["id"]=> string(6) "MD8470" ["distance_km"]=> int(10) ["distance_mi"]=> int(6) } [2]=> object(stdClass)#188 (7) { ["neighborhood"]=> string(12) "Lei Cheng Uk" ["city"]=> string(14) "Cheung Sha Wan" ["state"]=> string(9) "Hong Kong" ["country"]=> string(5) "CHINA" ["id"]=> string(9) "IU9999U63" ["distance_km"]=> int(25) ["distance_mi"]=> int(15) } [3]=> object(stdClass)#189 (7) { ["neighborhood"]=> string(14) "Sha Pa Village" ["city"]=> string(6) "Tai Po" ["state"]=> string(2) "NT" ["country"]=> string(9) "HONG KONG" ["id"]=> string(9) "ISDSTANL2" ["distance_km"]=> int(27) ["distance_mi"]=> int(16) } [4]=> object(stdClass)#190 (7) { ["neighborhood"]=> string(19) "Ma Yau Tong Village" ["city"]=> string(8) "Sai Kung" ["state"]=> string(9) "HONG KONG" ["country"]=> string(5) "China" ["id"]=> string(9) "IHONGKON9" ["distance_km"]=> int(34) ["distance_mi"]=> int(20) } [5]=> object(stdClass)#191 (7) { ["neighborhood"]=> string(20) "APRSWXNET Saikung HK" ["city"]=> string(8) "Junk Bay" ["state"]=> string(2) "HK" ["country"]=> string(2) "CI" ["id"]=> string(6) "MD2902" ["distance_km"]=> int(35) ["distance_mi"]=> int(21) } } } } } ["current_observation"]=> object(stdClass)#192 (47) { ["image"]=> object(stdClass)#193 (3) { ["url"]=> string(53) "http://icons-ak.wxug.com/graphics/wu2/logo_130x80.png" ["title"]=> string(19) "Weather Underground" ["link"]=> string(27) "http://www.wunderground.com" } ["display_location"]=> object(stdClass)#194 (10) { ["full"]=> string(34) "Hong Kong International, Hong Kong" ["city"]=> string(23) "Hong Kong International" ["state"]=> string(2) "HK" ["state_name"]=> string(9) "Hong Kong" ["country"]=> string(2) "CI" ["country_iso3166"]=> string(2) "CN" ["zip"]=> string(5) "00000" ["latitude"]=> string(11) "22.30888939" ["longitude"]=> string(12) "113.91471863" ["elevation"]=> string(10) "5.00000000" } ["observation_location"]=> object(stdClass)#195 (8) { ["full"]=> string(11) "Hong Kong, " ["city"]=> string(9) "Hong Kong" ["state"]=> string(0) "" ["country"]=> string(2) "CI" ["country_iso3166"]=> string(2) "CN" ["latitude"]=> string(11) "22.30999947" ["longitude"]=> string(12) "113.91000366" ["elevation"]=> string(5) "26 ft" } ["estimated"]=> object(stdClass)#196 (0) { } ["station_id"]=> string(4) "VHHH" ["observation_time"]=> string(41) "Last Updated on November 14, 10:00 PM CST" ["observation_time_rfc822"]=> string(31) "Mon, 14 Nov 2011 22:00:00 +0800" ["observation_epoch"]=> string(10) "1321279200" ["local_time_rfc822"]=> string(31) "Mon, 14 Nov 2011 22:06:36 +0800" ["local_epoch"]=> string(10) "1321279596" ["local_tz_short"]=> string(3) "HKT" ["local_tz_long"]=> string(14) "Asia/Hong_Kong" ["weather"]=> string(13) "Partly Cloudy" ["temperature_string"]=> string(11) "75 F (24 C)" ["temp_f"]=> int(75) ["temp_c"]=> int(24) ["relative_humidity"]=> string(3) "69%" ["wind_string"]=> string(22) "From the ESE at 10 MPH" ["wind_dir"]=> string(3) "ESE" ["wind_degrees"]=> int(120) ["wind_mph"]=> int(10) ["wind_gust_mph"]=> int(0) ["pressure_mb"]=> string(4) "1019" ["pressure_in"]=> string(5) "30.09" ["pressure_trend"]=> string(1) "0" ["dewpoint_string"]=> string(11) "64 F (18 C)" ["dewpoint_f"]=> int(64) ["dewpoint_c"]=> int(18) ["heat_index_string"]=> string(2) "NA" ["heat_index_f"]=> string(2) "NA" ["heat_index_c"]=> string(2) "NA" ["windchill_string"]=> string(2) "NA" ["windchill_f"]=> string(2) "NA" ["windchill_c"]=> string(2) "NA" ["visibility_mi"]=> string(3) "6.2" ["visibility_km"]=> string(4) "10.0" ["precip_1hr_string"]=> string(25) "-9999.00 in (-9999.00 mm)" ["precip_1hr_in"]=> string(8) "-9999.00" ["precip_1hr_metric"]=> string(8) "-9999.00" ["precip_today_string"]=> string(16) "0.00 in (0.0 mm)" ["precip_today_in"]=> string(4) "0.00" ["precip_today_metric"]=> string(3) "0.0" ["icon"]=> string(12) "partlycloudy" ["icon_url"]=> string(50) "http://icons-ak.wxug.com/i/c/k/nt_partlycloudy.gif" ["forecast_url"]=> string(54) "http://www.wunderground.com/global/stations/45007.html" ["history_url"]=> string(77) "http://www.wunderground.com/history/airport/VHHH/2011/11/14/DailyHistory.html" ["ob_url"]=> string(90) "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=22.30999947,113.91000366"