http://codepen.io/docwali777/pen/akXryk
My location was shown as Vecrīga, North Holland, which is interesting, but not quite correct! Sun is shining here in Amsterdam, but it tells me it’s raining
Looks like you hardcoded the country code in the Openweathermap request URL, which leads to strange results. Your IP API does return a country code, so you might be better off using that.
It shows my location as Washington DC, although i’m in Europe (btw, I’m actually about 40km from Vecrīga ).
Also its 12C here, but your app shows 33C (I wish ).
Also your layout is not responsive - it looks good only on wide screen, try to resize the window and you’ll see.
It got everything right for me, but ip-api.com is generally unreliable. The temperature conversion and current weather work, though, so great job!
Thanks for the feedback… I made some changes and hopefully this improves the accuracy…
Nothing changed.
You are getting location by IP and then you are taking a ZIP code from those results and calling openweathermap with it. After that you’re displaying results from openweathermap + city from IP results.
The problem is, that outside US there are no standardized postal codes. For example postal code for Amsterdam Provincie Noord-holland, Netherlands
is 1001, and for Riga center, Latvia
(this is Vecrīga) it is also 1001 (there are country prefixes, but http://ip-api.com/json ignores them).
For my location http://ip-api.com/json doesn’t detect ZIP code at all, so I suppose openweathermap just defaults to Washington DC.
You should either add country code to your openweathermap API call or call with lat
and lon
instead of zip.