Question

Microsoft has a weather API very similar to Google's (which now appears to be completely dead). I've converted one of my applications over to their feed, but I've been unable to find a list of all possible weather conditions.

This is documented fairly well for Google's weather API, but I can't find a list of conditions for the MSN weather API.

FWIW, an example URL to get data back using MSN is:

http://weather.service.msn.com/data.aspx?weadegreetype=F&culture=en-US&weasearchstr=Chicago,IL (service not available anymore (Jan 2016))

Can anyone shed some light on the possible conditions? I need them so that I can convert the condition text to an icon instead.

Was it helpful?

Solution

I decided to go a slightly different route and figure out conditions based on the icon provided (skycode and skycodeday) from the XML.

Here is a list of what I came up with. Hopefully it will be helpful for others in migrating from Google's weather API:

  • 0, 1 ,2, 3 ,4, 17, 35 - Thunderstorm
  • 5 - Rain/Snow mix
  • 6 - Sleet/Snow mix
  • 7 - Rain/Snow/Sleet mix
  • 8,9 - Icy
  • 10 - Rain/Sleet mix
  • 11 - Light Rain
  • 12 - Rain
  • 13 - Light Snow
  • 14,16,42,43 - Snow
  • 15 - Blizzard
  • 18,40 - Showers
  • 19 - Dust
  • 20 - Fog
  • 21 - Haze
  • 22 - Smoke
  • 23,24 - Windy
  • 25 - Frigid
  • 26 - Cloudy
  • 27,29,33 - Partly Cloudy (night)
  • 28,30,34 - Partly Cloudy
  • 31 - Clear (night)
  • 32 - Clear
  • 36 - Hot
  • 37,38 - Scattered Thunderstorms
  • 39 - Scattered Showers
  • 41 - Scattered Snow Showers
  • 44 - N/A
  • 45 - Scattered Rain Showers (night)
  • 46 - Scattered Snow Showers (night)
  • 47 - Scattered Thunderstorms (night)

OTHER TIPS

Here's my function, to easily convert your Google API code to MSN API:

function skycode2image ($skycode)
{    

$daynight = "na";

$skycodes = array ( 
0 => 'thunderstorm', 
1 => 'thunderstorm',
2 => 'thunderstorm',
3 => 'thunderstorm',
4 => 'thunderstorm',
5 => 'rain_snow',
6 => 'sleet',
7 => 'rain_snow',
8 => 'icy',
9 => 'icy',  
10 => 'rain_snow', 
11 => 'showers',
12 => 'rain',
13 => 'flurries',
14 => 'snow', 
15 => 'snow', 
16 => 'snow', 
17 => 'thunderstorm',
18 => 'showers',
19 => 'dust',
20 => 'fog',
21 => 'haze',
22 => 'haze',
23 => 'windy',
24 => 'windy',
25 => 'icy',
26 => 'cloudy',
27 => 'mostly_cloudy',
28 => 'mostly_cloudy',
29 => 'partly_cloudy', 
30 => 'partly_cloudy',
31 => 'sunny',
32 => 'sunny',
33 => 'mostly_sunny',
34 => 'mostly_sunny',
35 => 'thunderstorm',
36 => 'hot',
37 => 'chance_of_tstorm',
38 => 'chance_of_tstorm', 
39 => 'chance_of_rain',
40 => 'showers',
41 - 'chance_of_snow',  
42 => 'snow',
43 => 'snow',
44 => 'na',
45 => 'chance_of_rain',
46 => 'chance_of_snow',
47 => 'chance_of_tstorm');

$condition =  $skycodes[$skycode];

if (in_array($skycode,array(27,29,31,33,31,45,46,47))) $daynight = 'night';
if (in_array($skycode,array(28,30,32,34,36,37,38,39,41))) $daynight = 'day';   

return array($condition,$daynight);

}

It seems there's lots of misinformation going on whenever Microsoft is in question. I was testing the MSN Weather API today; and it did return; and is returning weather data, hourly.

I made the following [probably non standard] query just now: "http://weather.service.msn.com/data.aspx?weasearchstr=ny,NY&culture=en-US&weadegreetype=C&src=msn"

And it did return exactly what was requested:

<weatherdata xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><weather weatherlocationcode="wc:USNY0309" weatherlocationname="New York, NY" url="http://a.msn.com/54/en-US/ct40.782,-73.832?ctsrc=msn" imagerelativeurl="http://blob.weather.microsoft.com/static/weather4/en-us/" degreetype="C" provider="Foreca" attribution="http://www.foreca.com/" attribution2="Foreca" lat="40.782" long="-73.832" timezone="-5" alert="" entityid="10109777" encodedlocationname="New+York%2C+NY"><current temperature="4" skycode="29" skytext="Partly Cloudy" date="2016-02-07" observationtime="18:00:00" observationpoint="New York, NY" feelslike="2" humidity="62" winddisplay="9 km/h East" day="Sunday" shortday="Sun" windspeed="9 km/h" /><forecast low="-3" high="5" skycodeday="31" skytextday="Clear" date="2016-02-06" day="Saturday" shortday="Sat" precip="" /><forecast low="1" high="7" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-07" day="Sunday" shortday="Sun" precip="10" /><forecast low="-3" high="3" skycodeday="16" skytextday="Snow" date="2016-02-08" day="Monday" shortday="Mon" precip="90" /><forecast low="0" high="1" skycodeday="30" skytextday="Partly Sunny" date="2016-02-09" day="Tuesday" shortday="Tue" precip="90" /><forecast low="-2" high="5" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-10" day="Wednesday" shortday="Wed" precip="50" /><toolbar timewindow="60" minversion="1.0.1965.0" /></weather><weather weatherlocationcode="wc:USNY0996" weatherlocationname="New York, NY" url="http://a.msn.com/54/en-US/ct40.714,-74.006?ctsrc=msn" imagerelativeurl="http://blob.weather.microsoft.com/static/weather4/en-us/" degreetype="C" provider="Foreca" attribution="http://www.foreca.com/" attribution2="Foreca" lat="40.714" long="-74.006" timezone="-5" alert="" entityid="23164" encodedlocationname="New+York%2C+NY"><current temperature="5" skycode="29" skytext="Partly Cloudy" date="2016-02-07" observationtime="18:00:00" observationpoint="New York, NY" feelslike="4" humidity="58" winddisplay="7 km/h East" day="Sunday" shortday="Sun" windspeed="7 km/h" /><forecast low="-7" high="4" skycodeday="31" skytextday="Clear" date="2016-02-06" day="Saturday" shortday="Sat" precip="" /><forecast low="1" high="7" skycodeday="28" skytextday="Mostly Cloudy" date="2016-02-07" day="Sunday" shortday="Sun" precip="10" /><forecast low="-2" high="3" skycodeday="16" skytextday="Snow" date="2016-02-08" day="Monday" shortday="Mon" precip="80" /><forecast low="-1" high="1" skycodeday="30" skytextday="Partly Sunny" date="2016-02-09" day="Tuesday" shortday="Tue" precip="80" /><forecast low="-3" high="5" skycodeday="30" skytextday="Partly Sunny" date="2016-02-10" day="Wednesday" shortday="Wed" precip="50" /><toolbar timewindow="60" minversion="1.0.1965.0" /></weather></weatherdata>

It's April, 2016, and it looks like Microsoft Weather data is still coming through: Washington state weather data (link is different from that shown in the OP's post--which is now discontinued).

The "wealocations" parameter in the link is different for every weather collection point; e.g., "USWA0367" is for Redmond, Washington. You can get your weather location code from here.

We are writing to notify you that the Microsoft Weather API will no longer be available for download and will be discontinued as of April 15, 2015, meaning it will no longer provide weather data. Accordingly, please remove the Microsoft Weather API from any of your products or apps that currently use it.

Here is a list of external providers who might be able to support your needs if you are interested in obtaining an alternate weather API:

http://api.accuweather.com/ 
http://www.wunderground.com/weather/api/d/pricing.html 
https://developer.forecast.io/

Disclaimer: Microsoft and Microsoft Weather are not affiliated or associated with any of the above companies in any way.

Thank You Microsoft Weather Team

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top