“Ants P.” [email protected] wrote
Does anyone know where I can find Country -> (State) -> City/Town data in
easy to read format (XML/JSON)?
There is a databse that provides city (and state/province information
the US and Canada). It is freely available, but requires a short message
the legal section of your site, as well as in any
that mention the address portion of the product. If sounds acceptable,
what you want is:
MaxMind’s worldcitiespop.txt database. The database is a text file
using the ISO-8859-1 encoding. It is a simple comma seperated value
database. The fields are CountryCode, ASCIICityName, CityName,
Population, Latitude, Longitude.
You can ignore the last 3 fields. You will need a database to match
CountryCodes to country names, but MaxMind provides one. A trivial 2
CSV file. You will also need a State/CanadaProvince-code to name, and
MaxMind also provides that too, as a trivial 2 field CSV file.
A few quick gotchas: The file is 130MB uncompressed, and is a 30 MB
download. The first line is not a record, but gives the feild names. A
cities might have country codes of “A1”,“A2”,“EU”,or “AP”. you should
include those, since they are special codes for the geoIP database. The
statecode feild has a numeric region code for countries other than the
Canada, I’d advise you ignore them.
The main database is at:
The license is at:
The Country Code and City Code databases are small enough they provide
as text on html pages: http://www.maxmind.com/app/iso3166 and
I hope this helps.