OpenWeatherMap returns incorrect current weather

Loc Pham picture Loc Pham · Aug 7, 2014 · Viewed 8.2k times · Source

I'm trying to implement an iphone app and i'm integration OpenWeatherMap to retrieve the current weather. However, I've noticed the data returned is incorrect (off by about 39 degree Fahrenheit).

Below is the JSON URL i'm using to retrieve current weather for Denver, Usa using Lan/Lon coordinates where xxxxxxxxxxxxx is my APPID key.

http://api.openweathermap.org/data/2.5/weather?APPID=xxxxxxxxxxxxx&lat=39.738539&lon=-104.981114

The temperature returned was 291.05988. From documentation read, this temperature unit is Kelvin. So to convert to Fahrenhiet, I take 291.05988 - 254.928 = 36.13188 degree Fahrenheit. However, the true current weather is 75 degree Fahrenheit. This is off by about 39 degrees.

Please advise what I'm doing wrong.

Thanks Loc

Answer

mfink picture mfink · Dec 16, 2015

For those cruising by later, you don't need to do any conversions for Fahrenheit, you can add another query param to your request for that:

Fahrenheit: units=imperial

... also the option for Celsius: units=metric

Example being:

http://api.openweathermap.org/data/2.5/weather?q=London&appid=XXXXXX&units=imperial

Found this here.