"Ants Pants"
<antsmailinglist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote
in message
news:v2pc1f9ecae1004071202t245eb8cbgd08ffb44c1dcaf1d-JsoAwUIsXouq+1Nelnf3ueG/Ez6ZCGd0@public.gmane.org>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 for
the US and Canada). It is freely available, but requires a short message in
the legal section of your site, as well as in any documention/advertisements
that mention the address portion of the product. If sounds acceptable, then
what you want is:
MaxMind''s worldcitiespop.txt database. The database is a text file
encoded
using the ISO-8859-1 encoding. It is a simple comma seperated value (CSV)
database. The fields are CountryCode, ASCIICityName, CityName, StateCode,
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 feild
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 few
cities might have country codes of
"A1","A2","EU",or "AP". you should not
include those, since they are special codes for the geoIP database. The
statecode feild has a numeric region code for countries other than the US or
Canada, I''d advise you ignore them.
The main database is at:
http://www.maxmind.com/download/worldcities/worldcitiespop.txt.gz
The license is at:
http://geolite.maxmind.com/download/geoip/database/LICENSE_WC.txt
The Country Code and City Code databases are small enough they provide them
as text on html pages: http://www.maxmind.com/app/iso3166 and
http://www.maxmind.com/app/iso3166_2 respectively.
I hope this helps.
--
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en.