wintersylf
wintersylf

Reputation: 177

MaxMind: Correlating files for lat/lng?

I've downloaded the City database from MaxMind found here:

http://geolite.maxmind.com/download/geoip/database/GeoLite2-City-CSV.zip

which contains no latitude/longitude information. that information seems be in a different file:

http://geolite.maxmind.com/download/geoip/database/GeoLiteCity_CSV/GeoLiteCity-latest.zip

however, when attempting to correlate the two I find that the subdivision codes do not match. for example the first file contains the line:

geoname_id,locale_code,continent_code,continent_name,country_iso_code,country_name,subdivision_1_iso_code,subdivision_1_name,subdivision_2_iso_code,subdivision_2_name,city_name,metro_code,time_zone

3369157,en,AF,Africa,ZA,"South Africa",WC,"Province of the Western Cape",,,"Cape Town",,Africa/Johannesburg

from which one can see that the first political subdivision for Cape Town is WC. The second file, however, offers the line:

locId,country,region,city,postalCode,latitude,longitude,metroCode,areaCode 244,"ZA","11","Cape Town","",-33.9258,18.4232,,

from which it can be seen that the "region" is "11", not "WC".

so a few questions:

1) how do I correlate these two sources of information? 2) if they cannot be correlated, is there some other file I should be looking at? 3) if MaxMind offers no consistency in their information, is there a better source for a list of city names around the world that offers geolocation information?

TIA

Upvotes: 0

Views: 395

Answers (1)

Greg Oschwald
Greg Oschwald

Reputation: 1735

The latitude and longitude are in the GeoLite2 blocks file, not the locations file. See the GeoLite2 CSV documentation. The reason for this is that coordinates may be more specific than the (generally) city-level locations in locations file.

The other zip file you link to is for the Legacy CSV and is not intended to be used with GeoLite2

Upvotes: 1

Related Questions