yaph / geonamescache

geonamescache - a Python library for quick access to a subset of GeoNames data.
https://pypi.org/project/geonamescache/
MIT License
99 stars 38 forks source link

Getting cities by name through alternate names #22

Closed kssomabes closed 4 years ago

kssomabes commented 4 years ago

In cities_by_name(), if the city name is Kiev, it would return an empty list but if the city name is Kyiv, it would return a list containing the city in Ukraine. Although both names pertain to the same city.

Would such enhancement be possible?

yaph commented 4 years ago

I use the data from the GeoNames project without making changes to it. For country names I added support for some common variants using the mapper feature. For cities a mapping of different spellings would get too large to maintain and probably lead to ambiguities. To answer you question, it is possible but I will not add it, sorry.

kssomabes commented 4 years ago

It's already included in the Geonames but I agree that this might complicate things and cause ambiguities later on. Thanks for addressing my issue! :smile:

yaph commented 4 years ago

I didn't realize that the raw data includes alternative city names. I think including them in the cities.json could be useful.

yaph commented 4 years ago
yaph commented 4 years ago

I just released version 1.2.0. Now you can search the cities data. The test file tests/test_geonamescache.py uses Kiev as an example. If the search result contains more than one record, the user of the library has to decide which one to choose.