MaxMind: Correlating files for lat/lng?

喜你入骨 提交于 2020-01-16 18:35:45

问题


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


回答1:


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



来源:https://stackoverflow.com/questions/29735768/maxmind-correlating-files-for-lat-lng

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!