This page has been robot translated, sorry for typos if any. Original content here.

Base GeoIP - countries and cities, June 2011 (+ update script)

An updated version of the Russian-language database of countries and cities was published. Main changes:
- due to the new database, the accuracy of determining the cities of Ukraine has increased
- From the free version of the base cities have disappeared, so the accuracy of determining the cities of other CIS countries has decreased
- added a script with which you can independently update the database (without adding new cities and countries)
- net_ru_2 and net_su tables were removed from the database, query examples were changed
The result of this work is available for free download.

The base is distributed in two versions: " Countries and cities " (21Mb, after installation ~ 122Mb) and " Only countries " 2Mb, after installation ~ 13Mb). Also in the archives is a small example of using the database on php.

The accuracy of the definition of the country is ~ 99%, the accuracy of determining the cities is ~ 95% average. A lot or a little - depends on the tasks that you are going to solve with the help of this database.

Demo - definition of your country and city by IP-address

To install the database, I recommend using programs like mysqldumper or through ssh
mysql -p -user database_data <file.sql

The " update script " (~ 300Kb, after installing ~ 1Mb) is adapted only for the current version of the database (June 2011), it is impossible to update with its help previous versions . To update the database, import the file geo_update_2011_06.sql (contains two technical tables), download the latest archives with maxmind and ipgeobase (see readme.txt) and run update_maxmind.php and update_ru.php from the console. When updating the maxmind city database, ~ 4 million select-s and ~ 2 million insert-s are executed, so the operation requires significant resources and time (~ 30-60 minutes). Updating the maxmind city database is done 20-30 minutes.

In the directory of countries there are islands that are not independent states, but are far removed from their metropolises.

In the directory of cities errors (including duplicates) are possible.

In the "Only Country" database there are blocks of IP only in European countries (from ipgeobase, net_euro table) and countries all over the world (including European ones, from maxmind, net_country_ip). Theoretically, European countries should be more accurately defined by the first option, but there was no practical verification.

Ideas for improving and improving the quality of the database are welcome.

Some statistics

In the current version of the base there are 94,615 settlements.

Number of settlements in different countries:
A country amount
Germany 18,468
USA 15,798
Italy 6,645
Austria 6,417
Spain 5,721
Australia 5,134
France 4,651
Russian Federation 3.287
Canada 3,027
Poland 2,844
Brazil 2.342
Switzerland 1,814
Belgium 1.589
Japan 1.445
Portugal 1.289
Ireland 1,128
Argentina 1.086
Mexico 1,069
Ukraine 800
China 724
Bulgaria 615
United Kingdom 585
Colombia 545
India 359
Luxembourg 359
South Africa 333
Norway 330
Turkey 304
New Zealand 280
Hungary 262
Serbia 221
Chile 203
Kazakhstan 194
Philippines 188
Czech Republic 176
Romania 171
The Republic of Korea 166
Slovakia 161
Sweden 159
Netherlands 157
Croatia 141
Ecuador 141
Finland 134
Guatemala 126
Venezuela 123
Honduras 121
Belarus 102
Iran 96
Greece 96
Lithuania 95
Israel 91
Latvia 89
Estonia 85
Moldova 85
Trinidad and Tobago 79
Peru 69
Barbados 56
Jamaica 56
Costa Rica 56
Indonesia 56
Dominican Republic 53
Mauritius 52
Denmark 51
Egypt 46
Morocco 43
Macedonia 41
Armenia 40
Nigeria 39
Vietnam 38
Algeria 38
Uruguay 36
Panama 36
Salvador 33
Slovenia thirty
Malaysia thirty

In the remaining countries less than 30 settlements.

Posted on 06/09/2011
The script for updating the maxmind database has been optimized, the operation is faster and consumes fewer computing resources.