OpenWeatherMap – best weather data API for your projects

Recently Weather Underground announced that they’re no longer supporting their free API plans.

I really liked WUnderground and used it in several projects, but if you’re relaying on external services you have to remember that your API provider can change. So don’t tie yourself with specific solution.

Are there better alternatives?

I switched into OpenWeatherMap recently. The main reason is excellent API and huge amount of stations in desired area (check it out for yourself). Other great advantage is that it has a free plan if you don’t have big need for weather data. You can use current weather condition data as well as forecasts. But there’s plenty of other data to use – of course there are endpoints with weather layers for maps among other resources such as historical weather data, air pollution or UV index.

How can you start?

Useful endpoints

  • Get current weather data in multiple locations using single request.
    The units are in metric standard (which means Celsius grades, meters and hPa) and you can choose your language (it’s used for weather conditions description):
    https://api.openweathermap.org/data/2.5/group?id=<station1>,<station2>,<station3>&units=metric&lang=<your-language-shortcode>&appid=<your-API-key>
  • Get current weather data using exact coordinates
https://api.openweathermap.org/data/2.5/forecast?lat=<your-latitude>&lon=<your-longitude>&units=metric&lang=<your-language-shortcode>&appid=<your-API-key>
  • Get weather forecast for given station id. The forecasts are for 5 days every 3 hours
https://api.openweathermap.org/data/2.5/forecast?id=<station-id>&units=metric&lang=<your-language-shortcode>&appid=<your-API-key>

Alternative weather data providers

Choosing your weather API provider you should consider another popular APIs: Yahoo Weather, World Weather Online or AccuWeather.
The main thing to consider is data quality in selected area or the amount of available stations. Another important thing is to prepare your software architecture for possible future provider changes.

 

Leave a Reply

Your email address will not be published.