Recently found some interesting gems that allow you to search postal codes via Geonames web service. In my case, I need more than just the country names, city names and region names. I need more relevant information like the currency code.
Run the following if you haven't already:
sudo gem install elecnix-ruby-geonames
Seems like a complex solution to a very simple problem. The most simple solution to load geonames data into a new database separate from your application. When you're running backups, you really don't need to backup data that hardly every changes so I think it's a good idea to have a separate database.
In my case it took me 4 minutes to load the data due to a minor issue regarding syntax.
LOAD DATA INFILE should be LOAD DATA LOCAL INFILE
6 megabytes of data migrated (2.5558s). Cool.
The data loaded does not have the full list of cities. But if you need the currency code (ISO 4217) of a country for instance that 2-second solution is definitely for you.comments powered byDisqus