OpenWeatherMap returns incorrect current weather

I am trying to implement an iphone application and I am integrating OpenWeatherMap to get the current weather. However, I noticed that the data returned was incorrect (around 39 degrees Fahrenheit).

Below is the JSON url I use to get the 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 returned temperature was 291.05988. From the documentation read this unit of temperature is Kelvin. Therefore, to translate into Fahrenhiet, I am taking 291.05988 - 254.928 = 36.13188 degrees Fahrenheit. However, the actual current weather is 75 degrees Fahrenheit. That's about 39 degrees.

Please advise what I am doing wrong.

Thanks Loc

+3


source to share


2 answers


I am answering my own question ...

I was naive to believe the comments written by OpenWeather and my calculations from Kelvin to Fahrenheit were wrong. From the OpenWeather link here , it says:

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



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

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

      

Hope others don't work with this statement as I did.

-4


source


For those who travel later, you don't need to do any conversions for Fahrenheit, you can add one more query parameter to your request:

Fahrenheit: units = imperial

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



Example:

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

      

Found here here .

+7


source







All Articles