Reputation: 2467
So, I'm trying to use Maxmind GeoLiteCity.dat through GeoIP gem: https://github.com/cjheath/geoip And, what bothers me: How would I possibly return the list of all countries (this is fairly easy, since there is an appropriate YAML file down there) and cities - but I don't have a clue, how to read the city list. All I know is that they are somehow stored in this .dat file
Can anyone help me with this one ? Where and how should I look ?
Upvotes: 0
Views: 2045
Reputation: 2419
.dat file is a database file where, in one way, contents are stored in table form, but in compressed form. Just find out which columns refers to countries and cities. In following links, there are similar questions:
Ruby sorting a .dat file by column
How can I handle large files in Ruby?
Getting a user country name from originating IP address with Ruby on Rails
Refer to above links and modify the codes to suit your needs.
Upvotes: 1