views:

188

answers:

3

I was wondering if there is an API that provides weather information in XML format, providing only City and Country.

It's even better if it has a way to return results based on IP Address.

+1  A: 

I developed a weather gadget for my company using the Yahoo weather RSS feed. You have to supply the WOEID to get the forecast. Its pretty easy.

Shoban
Where on earth do I find this WOEID?
Anurag
WOEID stands for Where on Earth ID .. You can get it for any location. If you are using yahoo weather then the numbers you see at the last in the url is the WOEID of that location. Just do a search you can also get th complete WOEID for the entire planet from Yahoo.
Shoban
Shoban, thanks for the detailed explanation. And it's probably really forward-thinking to have it for the entire planet, but as soon as we settle on Mars, I'm gonna need that new WOEID.
Anurag
@Anurag once we are on Mars then its WOMID :)
Sri Kumar
+1  A: 

I use a sed script. wget -q -O - http://newsrss.bbc.co.uk/weather/forecast/2302/Next3DaysRSS.xml?area=HP6 | grep title | sed -e "s/<[^>]*>//g" -e "s/ &#176//g" | egrep "^[A-Z]" | sed -e 's/&#xB0;/°/g' To get weather for my workplace.

Niceguy
So I guess you could write another script that got the Postcode from a IP. And parsed that into the URL. Simplez ;)
Niceguy