Weather forecast add-on for ExpressionEngine

Parameters

The key parameter (required):

Weather Forecast requires an API key form Wunderground (free in most cases). Sign up for a key at www.wunderground.com.

The location parameter (required):

For the location (location="NL/Leiden"), there are different options:

  • US state/city: CA/San Francisco
  • US zipcode: 60290
  • Country/city: AU/Sydney
  • Latitude,longitude: 37.8,-122.4
  • Airport code: KJFK
  • Personal Weather Station id: pws:KCASANFR70
  • AutoIP address location: autoip
  • Specific IP address location: autoip.json?geo_ip=38.102.136.138

Wunderground uses different country codes than standard ISO. Expand the country code table for more information:

CountryWundergroundISO
AfghanistanAHAF
AlbaniaABAL
AlgeriaALDZ
American samoaASAS
AndorraADAD
AngolaANAO
AnguillaA1AI
AntarcticaAAAQ
Antigua and BarbudaATAG
ArgentinaAGAR
ArmeniaAMAM
ArubaAWAW
AustraliaAUAU
AustriaOSAT
AzerbaijanA2AZ
BahamasBSBS
BahrainBNBH
BangladeshBWBD
BarbadosBRBB
BelarusBYBY
BelgiumBXBE
BelizeBHBZ
BeninBJBJ
BermudaBEBM
BhutanB2BT
BoliviaBOBO
Bosnia and HerzegowinaBABA
BotswanaBCBW
Bouvet IslandBVBV
BrazilBZBR
British Indian Ocean TerritoryBTIO
Brunei darussalamBFBN
BulgariaBUBG
Burkina fasoHVBF
BurundiBIBI
CambodiaKHKH
CameroonCMCM
CanadaCACA
Cape VerdeCVCV
Cayman islandsGCKY
Central african republicCECF
ChadCDTD
ChileCHCL
ChinaCICN
Christmas islandCXCX
Cocos (keeling) islandsCCCC
ColombiaCOCO
ComorosICKM
CongoCGCG
CongoCDCD
Cook islandsKUCK
Costa RicaCSCR
Cote d'IvoireIVCI
CroatiaRHHR
CubaCUCU
CyprusCYCY
Czech republicCZCZ
DenmarkDNDK
DjiboutiDJDJ
DominicaDODM
Dominican republicDRDO
EcuadorEQEC
EgyptEGEG
El SalvadorESSV
Equatorial GuineaGQGQ
EritreaE1ER
EstoniaEEEE
EthiopiaETET
Falkland IslandsFKFK
Faroe IslandsFAFO
FijiFJFJ
FinlandFIFI
FranceFRFR
French GuianaFGGF
French PolynesiaPFPF
French Southern TerritoriesTFTF
GabonGOGA
GambiaGBGM
GeorgiaGEGE
GeorgiaDLDE
GhanaGHGH
GibraltarGIGI
GreeceGRGR
GreenlandGLGL
GrenadaGDGD
GuadeloupeGPGP
GuamGUGU
GuatemalaGUGT
GuineaGNGN
Guinea-bissauGWGW
GuyanaGYGY
HaitiHAHT
Heard and mc Donald IslandsHMHM
Vatican city stateVAVA
HondurasHOHN
Hong KongHKHK
HungaryHUHU
IcelandILIS
IndiaININ
IndonesiaIDID
IranIRIR
IraqIQIQ
IrelandIEIE
IsraelISIL
ItalyIYIT
JamaicaJMJM
JapanJPJP
JordanJDJO
KazakhstanKZKZ
KenyaKNKE
KiribatiKBKI
Korea, democratic people's republic ofKRKP
Korea, republic ofKOKR
KuwaitKWKW
KyrgyzstanKGKG
Lao people's democratic republicLALA
LatviaLVLV
LebanonLBLB
LesothoLSLS
LiberiaLILR
Libyan arab jamahiriyaLYLY
LiechtensteinLTLI
LithuaniaL1LT
LuxembourgLULU
MacauMUMO
MacedoniaMKMK
MadagascarMGMG
MalawiMWMW
MalaysiaMSMY
MaldivesMVMV
MaliMIML
MaltaMLMT
Marshall IslandsMHMH
Northern mariana islandsMPMP
MartiniqueMRMQ
MauritaniaMTMR
MauritiusMAMU
MayotteYTYT
MexicoMXMX
MicronesiaUS_FMFM
MoldovaM1MD
MonacoM3MC
MongoliaMOMN
MontserratM2MS
MoroccoMCMA
MozambiqueMZMZ
MyanmarBMMM
NamibiaNMNA
NauruNWNR
NepalNPNP
NetherlandsNLNL
Netherlands AntillesANAN
New ZealandNZNZ
New CaledoniaNCNC
NicaraguaNKNI
NigerNRNE
NigeriaNING
NiueN1NU
Norfolk IslandXX_NFNF
Northern Mariana IslandsUS_MPMP
NorwayNONO
OmanOMOM
PakistanPKPK
PalauPWPW
Palestinian territoryPSPS
PanamaPMPA
Papua New GuineaNGPG
ParaguayPYPY
PeruPRPE
PhilippinesPHPH
PitcairnP2PN
PolandPLPL
PortugalPOPT
Puerto RicoPRPR
QatarQTQA
ReunionRERE
RomaniaRORO
Russian federationRSRU
RwandaRWRW
Saint HelenaHESH
Saint kitts and nevisK1KN
Saint luciaLCLC
Saint pierre and miquelonP1PM
Saint Vincent and the GrenadinesVCVC
SamoaZMWS
San MarinoSMSM
Sao Tome and PrincipeTPST
Saudi ArabiaSDSA
SenegalSGSN
Serbia and MontenegroSCSC
Sierra LeoneSLSL
SingaporeSRSG
SlovakiaS1SK
SloveniaLJSI
Solomon IslandsSOSB
SomaliaSISO
South AfricaZAZA
South Georgia and the South Sandwich IslandsGSGS
SpainSPES
Sri LankaSBLK
SudanSUSD
SurinameSMSR
Svalbard and Jan Mayen IslandsSJSJ
SwazilandSVSZ
SwedenSNSE
SwitzerlandSWCH
Syrian Arab RepublicSYSY
TaiwanTWTW
TajikistanTJTJ
Tanzania, United republic ofTNTZ
ThailandTHTH
Timor-lesteEATL
TogoTGTG
TokelauTKTK
TongaTOTO
Trinidad and TobagoTDTT
TunisiaTSTN
TurkeyTUTR
TurkmenistanTMTM
Turks and Caicos IslandsTITC
TuvaluTVTV
Saint BarthelemyTBTB
UgandaUGUG
UkraineURUA
United Arab EmiratesERAE
United KingdomUKUK
United StatesUSUS
United States Minor Outlying IslandsUS_UMUM
UruguayUYUY
UzbekistanUZUZ
VanuatuNHVU
VenezuelaVNVE
VietnamVSVN
Virgin Islands (British)VGVG
Virgin Islands (U.S.)VIVI
Wallis and Futuna IslandsFWWF
Western SaharaEHEH
YemenYEYE
SerbiaRBRS
KosovoKVKV
MontenegroM4ME
ZambiaZBZM
ZimbabweZWZW

The language parameter (optional):

Use a language code (language="FR"). Default language is English. Expand the language code table for more information:

LanguageLanguage Code
AfrikaansAF
AlbanianAL
ArabicAR
ArmenianHY
AzerbaijaniAZ
BasqueEU
BelarusianBY
BulgarianBU
British EnglishLI
BurmeseMY
CatalanCA
Chinese - SimplifiedCN
Chinese - TraditionalTW
CroatianCR
CzechCZ
DanishDK
DhivehiDV
DutchNL
EnglishEN
EsperantoEO
EstonianET
FarsiFA
FinnishFI
FrenchFR
French CanadianFC
GalicianGZ
GermanDL
GeorgianKA
GreekGR
GujaratiGU
Haitian CreoleHT
HebrewIL
HindiHI
HungarianHU
IcelandicIS
IdoIO
IndonesianID
Irish GaelicIR
ItalianIT
JapaneseJP
JavaneseJW
KhmerKM
KoreanKR
KurdishKU
LatinLA
LatvianLV
LithuanianLT
Low GermanND
MacedonianMK
MalteseMT
MandinkaGM
MaoriMI
MarathiMR
MongolianMN
NorwegianNO
OccitanOC
PashtoPS
PlautdietschGN
PolishPL
PortugueseBR
PunjabiPA
RomanianRO
RussianRU
SerbianSR
SlovakSK
SlovenianSL
SpanishSP
SwahiliSI
SwedishSW
SwissCH
TagalogTL
TatarishTT
ThaiTH
TurkishTR
TurkmenTK
UkrainianUA
UzbekUZ
VietnameseVU
WelshCY
WolofSN
Yiddish - transliteratedJI
Yiddish - unicodeYI

The imagepath parameter (optional):

If you want to use your own icons specify your imagepath (imagepath="images/"). Default icons are Wunderground's weather icons.

The extension parameter (optional):

If you use your custom icons you can specify the file format (extension="png"). Default extension is gif.

The caching parameter (optional)

The number of minutes between cache refreshes. The default is 60 minutes. (cache_refresh="120")

Example

{exp:weather_forecast key="1234567890abc" location="NY/New York" language="EN" imagepath="images/" extension="png" cache_refresh="10"}

  • {city}

    <!-- returns city -> New York -->
  • {forecast_date}

    <!-- returns the date of the forecast -> 16 Sep 2012 -->
  • {current_date_time}

    <!-- returns the time of the forecast -> 06:55 -->
  • {current_temp_c}

    <!-- returns the current temperature in Celsius -> 17.2 -->
  • {current_temp_f}

    <!-- returns the current temperature in Fahrenheit -> 62 -->
  • {current_condition}

    <!-- returns the current condition -> Clear -->
  • {current_humidity}

    <!-- returns the current humidity -> 52% -->
  • {current_icon}

    <!-- returns the current icon -> <img alt="sunny" src="images/sunny.gif"> (source depends on default or custom image path). -->
  • {current_icon_day_and_night}

    <!-- returns the current day or night icon (clear and nt_clear) based on location -> <img alt="clear" src="images/nt_clear.gif"> (source depends on default or custom image path). -->
  • {current_wind_direction}

    <!-- returns the current wind direction -> SE -->
  • {current_wind_speed_mph}

    <!-- returns the current wind speed in miles -> 0 -->
  • {current_wind_speed_kph}

    <!-- returns the current wind speed in kilometers -> 0 -->
  • {current_wind_speed_bft}

    <!-- returns the current wind speed in beaufort -> 0 -->
  • {day_of_week_0}

    <!-- returns the forecast of today and the next 3 days {day_of_week_0}... {day_of_week_3} -> Sun -->
  • {text_0_c}

    <!-- returns the forecast in text of today and the next 3 days {text_0_c}... {text_3_c} in Celcius -> Partly cloudy. Fog early. High of 20C. Breezy. Winds from the WSW at 15 to 25 km/h. -->
  • {low_0_c}

    <!-- returns the low temperature of today and the next 3 days {low_0_c}... {low_3_c} in Celcius -> 15 -->
  • {high_0_c}

    <!-- returns the high temperature of today and the next 3 days {high_0_c}... {high_3_c} in Celcius -> 25 -->
  • {text_0_f}

    <!-- returns the forecast in text of today and the next 3 days {text_0_c}... {text_3_c} in Fahrenheit -> Partly cloudy. Fog early. High of 68F. Breezy. Winds from the WSW at 10 to 15 mph. -->
  • {low_0_f}

    <!-- returns the low temperature of today and the next 3 days {low_0_f}... {low_3_f} in Fahrenheit -> 59 -->
  • {high_0_f}

    <!-- returns the high temperature of today and the next 3 days {high_0_f}... {high_3_f} in Fahrenheit -> 77 -->
  • {icon_0}

    <!-- returns the weather icon of today and the next 3 days {icon_0}... {icon_3} -> <img alt="sunny" src="images/mostly_sunny.gif"> (source depends on default or custom image path). -->
  • {wind_speed_0_mph}

    <!-- returns the windspeed of today and the next 3 days {wind_speed_0_mph}... {wind_speed_3_mph} in miles -> 12 -->
  • {wind_speed_0_kph}

    <!-- returns the windspeed of today and the next 3 days {wind_speed_0_kph}... {wind_speed_3_kph} in kilometers -> 19 -->
  • {wind_speed_0_bft}

    <!-- returns the windspeed of today and the next 3 days {wind_speed_0_bft}... {wind_speed_3_bft} in beaufort -> 3 -->
  • {wind_speed_0_dir}

    <!-- returns the winddirection of today and the next 3 days {wind_speed_0_dir}... {wind_speed_3_dir} -> WSW -->
  • {condition_0}

    <!-- returns the condition of today and the next 3 days

    {condition_0}... {condition_3} -> Partly Cloudy -->

{/exp:weather_forecast}

Icons

If you want to use custom icons, you should have the folowing images. Use the same filesname with nt_ in front, when you use nighttime icons (nt_chanceflurries).

Conditon Icon Name Icon Day Icon Night
Chance of Flurrieschanceflurries
Chance of Rainchancerain
Chance of Freezing Rainchancesleet
Chance of Sleetchancesleet
Chance of Snowchancesnow
Chance of Thunderstormschancetstorms
Chance of a Thunderstormchancetstorms
Clearclear
Cloudycloudy
Flurriesflurries
Fogfog
Hazehazy
Mostly Cloudymostlycloudy
Mostly Sunnymostlysunny
Partly Cloudypartlycloudy
Partly Sunnypartlysunny
Freezing Rainsleet
Rainrain
Sleetsleet
Snowsnow
Sunnysunny
Thunderstormststorms
Thunderstormtstorms
Unknownunknown
Overcastcloudy
Scattered Cloudspartlycloudy

Wind direction

Below are the wind directions, the codes are in English and they depend on the used language.

Wind Direction Code Wind Direction Code
East-northeastENEEast-southeastESE
NortheastNENorth-northeastNNE
North-northwestNNWNorthwestNW
SoutheastSESouth-southeastSSE
South-southwestSSWSouthwestSW
West-northwestWNWWest-southwestWSW

villerius.net