I'm getting the weather for a city using openweathermap.org.
The jsonp call is working and everything is fine but the resulting object contains the temperature in an unknown unit:
{
//...
"main": {
"temp": 290.38, // What unit of measurement is this?
"pressure": 1005,
"humidity": 72,
"temp_min": 289.25,
"temp_max": 291.85
},
//...
}
Here is a demo that console.log
's the full object.
I don't think the resulting temperature is in fahrenheit because converting 290.38
fahrenheit to celsius is 143.544
.
Does anyone know what temperature unit openweathermap is returning?
It looks like kelvin. Converting kelvin to celsius is easy: Just subtract 273.15.
And the briefest glance at the API documentation tells us that if you add &units=metric
to your request, you'll get back celsius.