New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
weather@mockturtl: Link to openweathermap.org brings up wrong city #3916
Comments
Unfortunately I only get lat/long back from openweathermap, they don't return the nearest town's ID which I can use to open the correct URL, so I rely on you (the user) to permit the website to use your location, so it displays the correct one. Alternatively I could open the map, but that is not really useful |
I just found this in https://openweathermap.org/api/hourly-forecast#cityid5:
There I.e. with this I was able to to open Botarell, ES -> city ID: 6361276 -> https://openweathermap.org/city/6361276 |
It's useful that the information is available, but note that file is 40Mb! To use it first I need to load it in memory, which would take the same amount of space just for a weather applet. Secondly, I either make you download it through updates (again 40Mb bigger update if they let me) or make you download it once at runtime. Both of the cases I will have to order the list by lat then long once (which would take quite a long) then use it to search. I can implement a proof of concept to show the performance and memory impact it would have if you like. For now, I messaged OpenWeatherMap about including the ID in their API output. |
Any update on this? Did OpenWeatherMap answer your request? Maybe we/one could build a mini API which returns the city ID with the given city... I played around with the OpenWeatherMap search and came up with:
So, unfortunately there are two results for
(The URL (with the appid) was taken from the Firefox Developer Tools, where I copied the request as cURL). |
I sent them an email, they just replied with boilerplate, then I sent a reply and they never got back to me so I forgot about it. They return the ID via the current weather call https://openweathermap.org/current#geo what I used to use, but it's still an extra network request I don't really want to make. Anyway, probably I will add it back in just for the ID with some kind of caching. Edit: This will get you the closest one it can find, but it might not match the city/country displayed in the applet because I don't get those from OpenWeatherMap either |
Works like a charm! Thank you very much! |
Notify author of applet: @mockturtl
Issue
After opening the applet and when clicking on the location at the top of the applet, the following URL is opened:
https://openweathermap.org/city/ which defaults to London, GB (or whatever city was opened last).
It would be nice if the given location/city is opened.
Steps to reproduce
Open the weather applet. Click on the location on the top. London, GB in https://openweathermap.org/city/ is opened.
Expected behaviour
https://openweathermap.org/city/ with the given location/city should open.
Other information
Thank very much for this cool applet!
The text was updated successfully, but these errors were encountered: