Search code examples
jsonweatherweather-apiopenweathermap

OpenWeatherMap returns incorrect current weather


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


Solution

  • I'm answering my own question...

    I was naived to believed the comments written by OpenWeather and had my calculation from Kelvin to Fahrenheit all wrong. From OpenWeather's link here, it states:

    Temperature in Kelvin. Subtracted 273.15 from this figure to convert to Celsius.

    That statement is WRONG. To convert from Kelvin to Fahrenheit, use this equation:

    ° F = 9/5(° K - 273) + 32
    

    Hope others won't get tripped by that statement like I did.