-
Notifications
You must be signed in to change notification settings - Fork 175
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
Cannot get city info for any US city #376
Comments
Hello @project-owner please take a look here: #309 you basically should specify the 2 letter name of the US country for your city instead of using a generic 'US'. In your example, if you look for 'New York' belonging to the the New York state, you must use use country='NY' instead of 'US'. please tell me if this works ok! thanks |
It works, thank you! |
PyOWM uses OpenWeatherMap's API which might or might not be used also by
the webpage you've found on their website
I can't check this out right now but IMO when you hit enter on their
searchbar, queries are run directly against their databases - this would
explain why the page behaves differently from the API
As regards the Canadian Vs California issue... Well, good one! I think this
is something OpenWeatherMap's guys should answer!!
Can you find a city in California and one in Canada having the exactly same
name? If so, please give it a whirl and see what results you get :)
Thanks
Claudio Sparpaglione
***@***.***
http://linkedin.com/in/claudiosparpaglione
…On Sun, May 16, 2021, 17:14 project-owner ***@***.***> wrote:
It works, thank you!
But how it will distinguish cities in California (CA) from the cities in
Canada (CA)?
I've tried to search on OpenWeather site: https://openweathermap.org/find
and it works fine for query 'New York, US' and for 'New York, NY, US' but
doesn't work for 'New York, NY'. Don't you use the same API for search?
Thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#376 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHOXXWX4CUGCD2ZFUMZIOTTN7ONBANCNFSM446GJIQQ>
.
|
There are some of them (https://en.wikipedia.org/wiki/List_of_U.S._places_named_after_non-U.S._places): Yahoo Weather is using both parameters: state + country. I'm not sure if it's possible somehow here. Thanks! |
This is their support center URL: https://openweathermap.force.com/s/contactsupport Anyway, just for you to know: when you call the locations_for function on the cityIDregistry object, pyOWM performs a local query against text files that were bundled from OpenWeatherMap at release time. If you take a look at those files, they tell "state" from "country" when country=US The mismatch between Californian and Canadian names could happen when you try to query e.g. the actual weather on them via pyOWM - which will invoke the remote OpenWeatherMap API. This is the case that needs to be investigated Thanks, pls keep me posted |
I'm not sure which file you use to look up the city info. I've had a look to this one: Here is the example for the city Ontario in Canada and California:
It would be possible to avoid ambiguity if you would query first by country and then by state. I believe the correct API would be:
where 'state' is optional. Thanks! |
I also cannot get the info for Washington:
returns empty list. |
Thanks @project-owner for notifying. Yes, the API you propose is the way to go and would be a breaking change with respect to today's usage of the I'd like to implement it - and maybe take the chance to innovate the way PyOWM stores city IDs internally (4 separate bz2 compressed files - here) I was thinking about shipping only 1 sqlite db file which can be natively queried from Python, but that should need to come with an acceptable size - ideally less than 10 MBs |
I'm migrating from the Yahoo Weather API which will reach end-of-life by June 1st. I hope to replace it by that time. If your new API won't be ready I will ask users to provide latitude/longitude instead of city name and country. You could create new function for example either 'locations_for_2' or 'locations_for_city' to avoid the breaking change in the API. |
@project-owner Hello, just to let you know that the refactoring is in the works (783cb8b) and will be shipped on the next release! |
Good news. I hope it will be able to coexist with my app which is also using SQLite. |
# New features [380](#380) Implemented [National Weather Alerts](https://openweathermap.org/api/one-call-api#listsource) support [376](#376) Now PyOWM uses SQLite instead of files to internally store city data. `CityIDRegistry` interface has changed but in a retrocompatible way # Chores [381](#381) Now it is possible to specify how many times to retry an API call # Bugfixes [379](#379) Experimental fix for `404` errors on Agromonitor API satellite image search [387](#387) Fixed lat/lon swap bug on Airpollution API [389](#389) Fixed wrong city name in City ID database
Hi, I'm trying to use the following function to get the city info:
It returns the empty list.
The following function returns non-empty list:
What could be the reason for the empty list in the first case? I tried many different US cities and all of them return empty list.
Thanks!
The text was updated successfully, but these errors were encountered: