8

I was wondering if there is a way to find the weather of specific town/city using Java. I have heard of Google Weather API but that has not yielded any results. I also have heard about using an .xml feed for finding the weather but where can I find that? Therefore, I have two questions, Is there a way to find the weather to find using Java and am I correct about the .xml?

John Slegers
  • 45,213
  • 22
  • 199
  • 169
Jeel Shah
  • 3,274
  • 17
  • 47
  • 68

2 Answers2

4

The Google Weather API appears to be no more:

http://thenextweb.com/google/2012/08/28/did-google-just-quietly-kill-private-weather-api/

But you can use others such as

http://www.wunderground.com/weather/api/

Once you have your XML (or JSON) you can parse it as described here:

Using Java to extract data from google Weather API

Community
  • 1
  • 1
davek
  • 22,499
  • 9
  • 75
  • 95
  • The link you have provided shows how to extract from google Weather API but is it still the same concept to extract from the API you have provided? – Jeel Shah Sep 17 '12 at 15:35
  • The various APIs will probably deliver XML or JSON: in which case the source is largely irrelevant: you just need to handle/process the result you get. – davek Sep 17 '12 at 15:36
  • So, wunderground will not not provide XML or JSON? – Jeel Shah Sep 17 '12 at 15:45
  • 1
    @gekkostate I've worked with the Wunderground API before on iOS. It provided JSON and it was very easy to use -- only downside is that it isn't free to use beyond messing around as a developer. I'm a bit surprised that the Google Weather API was pulled, and relieved -- I was thinking about using it for my project only months prior. – Anthony Neace Oct 09 '12 at 02:45
3

you can use openweathermap api for this. Go to this link and download api and you can also see some examples to use it http://openweathermap.org/api