OpenWeather icon indicating copy to clipboard operation
OpenWeather copied to clipboard

api calls "long" instad of "lon" when calling from lat and long for current weather

Open ThatMattCraig opened this issue 2 years ago • 1 comments

great library!!! just one issue I found

I have to call by lat and long because there are many cities with the same name.

by default the library is calling for : api.openweathermap.org/data/2.5/weather?lat={latitude}&long={longitude}&appid={apiKey} //default

this is causing error 400, nothing to geocode.

the request for longitude requires "lon" instead of "long"

api.openweathermap.org/data/2.5/weather?lat={latitude}&lon=-{latitude}&appid={apiKey} //updated

when I use the edited version it works.

i only edited line 34 in SimpleWeather.cpp for my specific sketch to work.

i changed: _url = "/data/2.5/weather?lat=" + String(lat) + "&long=" + String(longi) + "&appid=" + Key +"&units=metric";

to: _url = "/data/2.5/weather?lat=" + String(lat) + "&lon=" + String(longi) + "&appid=" + Key +"&units=imperial";

again great library it saved me tons of time.

ThatMattCraig avatar Jul 31 '23 16:07 ThatMattCraig

@ThatMattCraig I think you meant to raise an issue against dushyantahuja/SimpleWeather and not this repo which is OpenWeather.

llamaonaskateboard avatar Oct 06 '23 02:10 llamaonaskateboard