Weather weather;
try
{
Weather weather = WeatherStation.getWeather("wirral");
}
catch(WeatherStationException wse)
{}
weather.getConditions(); //Returns a string, such as "Fog", "Partly Cloudy"
weather.getTemperature(); //returned in degree celsius
So as you can see, incorporating this API into any application is trivial. The API also supports the forecast for weather. So, for example, it could be successfully utilised as:
Forecast forecast;
try
{
forecast = WeatherStation.getForecast("wirral");
}
catch(WeatherStationException wse
{}
for(Weather weather: forecast.getForecast()) //returns a list of Weather (4 days)
{
System.out.println(weather.getDate() + " is forecast for " + weather.getConditions());
}
}
This is something I have personally utilised as part of Jarvis - the virtual assistant. By utilising this API in my system I receive weather updates automatically each morning, giving me the current condition and forecast data then receiving another update at night giving me tomorrows forecast. The updates are mostly delivered using my T-Mobile API. It is further utilised by the fact that Jarvis has access to my Google Calendar, so for each event Jarvis also delivers the weather conditions.
In the meantime if you would like access to this code please feel free to contact me.
5 comments:
Hi
java weather Api will play important role for future software development.I am a computer engineering student , i am working on college project, in that i want forecasted wind data. Can u help me on this.
regards
preet
I would love a copy of the API please!
Where is the API source code or jar? :)
I would to get a copy of jar lib for java weather api
I would like to have the API to use in a demo I am making.
Post a Comment