elixir-geolix / geolix

IP information lookup provider
Apache License 2.0
190 stars 18 forks source link

Search by city name? #6

Closed lau closed 9 years ago

lau commented 9 years ago

Hi. Have you considered adding a feature to look up results by city names? It would be useful if you want to know the timezone identifier for a certain city name, but you don't have an IP address.

For instance if you want to know what the timezone identifier is for Houston, Texas you could do a lookup by "Houston" and it would return results for matching cities containing time_zone: "America/Chicago".

mneudert commented 9 years ago

Well, at the moment that would not be possible.

The MaxMind databases are intended to only look up an ip address. Due to the way the data is stored in the databases there is probably no sane way to lookup a city without having an ip address for it.

To support such a lookup it would be necessary to add a real timezone database (https://timezonedb.com/ and the like) and hook it into the lookup process.

Having a separate app for the timezone data would make it easy to lookup data the way you suggested. But that would probably have to go directly to the timezone app for quite some time. For a long term plan it might be a thing to extend the generic scope to provide "all sorts of geolocation data" and directly support the timezone lookup.

Until then I think an ip address is the only way to get a result.

lau commented 9 years ago

Maybe it would be possible to use it for searching cities, but I believe that it is not feasible to do in this project.

That timezonedb does not seem super useful compared to tzdata. It does not have city names (in different languages) tied to coordinates and timezones like maxmind does. But I have googled and found geonames.org which seems to provide.

Thanks for responding. I will probably use your library some time. For finding a timezone identifier for a city name I think I might do a library based on geonames.org data.