mail me! sindicaci;ón

Java Weather API

I’ve also been spending quite a lot of time with a friend developing a Java Weather API, which is now almost nearing completion (85th revision and counting). I’ve been using the API as part of a larger system that monitors climate conditions in certain locations during the course of a year, collating the results which will later be used to generate graphs and other statistics.

The API is pretty simple, but certainly effective, and makes use of Google’s own weather API that’s provided as a SOAP service.

The API parses the XML feed given by Google, and constructs Weather objects that can then further be manipulated.

Here’s a simple example of how the API could be used:

try
{
   Weather weather = WeatherStation.getWeather("wirral");
}
catch(WeatherStationException wse)
{} // Bad!

weather.getConditions();  //Returns a string, such as "Fog", "Partly Cloudy"
weather.getTemperature(); //Default is to return result in degree celsius

As with my last post, we do fully intend to make these APIs available publicly at some point in the near future.

Leave a Comment