Reputation: 69
I am an absolute newbie at openweather. When I tried their examples and was scrolling down the information, the temperature of Melbourne was 297.42. I can confirm it definitely was not so my question is do I have to format the temperature somehow because it is not really conventional (as it is a 3 digit number) and I was thinking it was wrong.
{
"temp":297.42,
"feels_like":298.33,
"temp_min":295.91,
"temp_max":299.24,
}
above is only a snapshot
Upvotes: 0
Views: 1760
Reputation: 1361
Temperature in Kelvin is used by default in openweather api. You need to add ?units=metric
to your api call to get Celsius.
Temperature is available in Fahrenheit, Celsius and Kelvin units.
For temperature in Fahrenheit use units=imperial
For temperature in Celsius use units=metric
Temperature in Kelvin is used by default, no need to use units parameter in API call
List of all API parameters with units openweathermap.org/weather-data.
You can specify the format you want returned for the temp. standard
, metric
, and imperial
units are available. http://api.openweathermap.org/data/2.5/weather?q=London&mode=json&units=metric
or
http://api.openweathermap.org/data/2.5/weather?q=London&mode=json&units=imperial
just pass units are parameter in api.
For conversions -
Kelvin to Fahrenheit is:
(( kelvinValue - 273.15) * 9/5) + 32
kelvin to celsius:
Just subtract 273.15.
Upvotes: 2