An updated version of the Russian-language database of countries and cities has been published. Major changes:
- due to the new base ipgeobase.ru, the accuracy of determining the cities of Ukraine has improved
- cities have disappeared from the free version of geobaza.ru; therefore, the accuracy of determining cities in other CIS countries has decreased
- added a script with which you can independently update the database (without adding new cities and countries)
- the net_ru_2 and net_su tables have been removed from the database, the sample queries have been changed
The result of this work is available for free download.
The database is distributed in two versions: “
Countries and cities ” (21Mb, after installing ~ 122Mb) and “
Countries only ” 2Mb, after installing ~ 13Mb). Also in the archives is a small example of using the database in php.
The accuracy of determining the country ~ 99%, the accuracy of determining the cities on average ~ 95%. Whether it is a lot or a little depends on the tasks that you are going to solve with the help of this base.
')
Test demo -
determine your country and city by IP-address
Work demo -
City definition by IP in the form of ticket search
To install the database, I recommend using programs like
mysqldumper or via ssh to execute
mysql –p –user database <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 the help of the previous versions . To update the database, import the geo_update_2011_06.sql file (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 database of cities, ~ 4 million selects and ~ 2 million insert s are performed, so the operation requires considerable resources and time (~ 30-60 minutes). Update maxmind database of cities takes 20-30 minutes.
In the directory of countries there are islands that are not independent states, but significantly removed from their metropolitan areas.
In the directory of cities errors are possible (including duplicates).
In the “Only countries” database there are IP blocks of only European countries (from ipgeobase, net_euro table) and countries around the world (including European, from maxmind, net_country_ip table). Theoretically, European countries should be more accurately determined by the first option, but there was no practical test.
Ideas to improve and improve the quality of the base are welcome.
Some statistics
In the current version of the base
94,615 settlements.
The 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 |
Great Britain | 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 | 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 other countries, less than 30 localities.
Posted 09/06/2011
Optimized script update database maxmind, the operation is faster and consumes less computational resources. Thanks
shushu for helpful advice.