Weather Info Not Correct
Closed this issue · 1 comments
ruidiasbraga commented
Hi,
I am requesting Weather for "Braga, PT", the information on the response, coordinates, id etc all correct, except the weather information like temperature and type of weather
I get like 15ºc light rains when in the site openweathermap.org I get 8ºC clear sky. What is the problem?
delsuza commented
Hi,
it's because the getCurrent function fetch the wrong endpoint :
var url = "http://api.openweathermap.org/data/2.5/forecast?q=" + encodeURIComponent(city) + "&cnt=1";
the good endpoint is :
var url = "http://api.openweathermap.org/data/2.5/weather?q=" + encodeURIComponent(city) + "&cnt=1";
Some functions must be edited :
Weather.Current.prototype.temperature = function () {
return this.data.main.temp;
};
Weather.Current.prototype.conditions = function () {
return this.data.weather[0].description;
};