Quickie databases (in JSON, of course)
(Note: all of the JSON files below I created/converted by hand using regular expressions, and I'm placing them into the public domain. The larger ones are compressed with gzip, which is a fast but efficient standardized compression system. (It's part of HTTP -- yes, even Internet Explorer has been able to decompress it for years.) If you need a program to decompress it, it's probably already built into your operating system. If your operating system doesn't support it, here's a nickel. I recommend Kubuntu (especially for desktops/laptops or newbies) which is built on Debian (for experts and servers).
Countries:
What I really needed was the ISO country codes, and although this looked useful, it didn't have them. Of course, a stroke of insanity has struck ISO and these are only available for purchase -- in MS Access format!
So, I converted this from raw text to JSON:
countries_by_name.json
countries_by_iso_code.json
U.S. Zip Codes
Matt Cutts hilariously blogs about his experiences digging up ZIP code databases at the Census vs the USPS. (see also http://www.census.gov/geo/www/tiger/zip1999.html)
And, in JSON format (about 2MB each gunzipped):
zips_by_zip.json.gz
zips_by_city_state.json.gz
Sample (Python script):
cjson.decode(open("zips_by_city_state.json").read())["CORTLAND, NY"]
IP to Country
This is probably one of the hardest to solve, but there are two free databases that I'm aware of. The last time I reviewed the MaxMind product it had a nasty (nasty!) license clause that essentially said that if you violated the terms of the license, they owned your entire product. Hmm -- what does that mean? I don't know, but I didn't want to find out. Proprietary software == crazy licenses. Ironically, there was a landmark case that lists of facts could not be copyrighted a few years ago.
Haven't reviewed it, but it looks pretty complete and it's released under the GPLv2:
http://software77.net/cgi-bin/ip-country/geo-ip.pl
And, of course, the IP to Country database by webhosting.info:
http://ip-to-country.webhosting.info/
This one makes less sense in JSON format, but here it is as a list of lists. This one is over 4MB uncompressed. See this page for info on how to translate the IP you're testing and scan for the range it fits in.
ip-to-country.json.gz
All of the JSON files listed in this post are released into the public domain.
Area Codes
The definitive resource is probably NANPA, but again with the MS Access. What is with that? Does anyone actually use it? What's wrong with text, CSV, JSON, XML, or even XLS?
area_codes.json
States
Another easy one: http://www.usps.com/ncsc/lookups/usps_abbreviations.html
This is a bit more than the 50 states, because it also includes the military locations of service and
regions and territories served by the U.S. Postal Service:
states.json
Countries:
What I really needed was the ISO country codes, and although this looked useful, it didn't have them. Of course, a stroke of insanity has struck ISO and these are only available for purchase -- in MS Access format!
So, I converted this from raw text to JSON:
countries_by_name.json
countries_by_iso_code.json
U.S. Zip Codes
Matt Cutts hilariously blogs about his experiences digging up ZIP code databases at the Census vs the USPS. (see also http://www.census.gov/geo/www/tiger/zip1999.html)
And, in JSON format (about 2MB each gunzipped):
zips_by_zip.json.gz
zips_by_city_state.json.gz
Sample (Python script):
cjson.decode(open("zips_by_city_state.json").read())["CORTLAND, NY"]
['13045', '36', 76.185675000000003, 42.595174999999998, 29180, 0.001622]cjson.decode(open("zips_by_zip.json").read())["90210"]
['06', 'CA', 'BEVERLY HILLS', 118.406477, 34.090107000000003, 20700, 0.000696]
IP to Country
This is probably one of the hardest to solve, but there are two free databases that I'm aware of. The last time I reviewed the MaxMind product it had a nasty (nasty!) license clause that essentially said that if you violated the terms of the license, they owned your entire product. Hmm -- what does that mean? I don't know, but I didn't want to find out. Proprietary software == crazy licenses. Ironically, there was a landmark case that lists of facts could not be copyrighted a few years ago.
Haven't reviewed it, but it looks pretty complete and it's released under the GPLv2:
http://software77.net/cgi-bin/ip-country/geo-ip.pl
And, of course, the IP to Country database by webhosting.info:
http://ip-to-country.webhosting.info/
This one makes less sense in JSON format, but here it is as a list of lists. This one is over 4MB uncompressed. See this page for info on how to translate the IP you're testing and scan for the range it fits in.
ip-to-country.json.gz
All of the JSON files listed in this post are released into the public domain.
Area Codes
The definitive resource is probably NANPA, but again with the MS Access. What is with that? Does anyone actually use it? What's wrong with text, CSV, JSON, XML, or even XLS?
area_codes.json
States
Another easy one: http://www.usps.com/ncsc/lookups/usps_abbreviations.html
This is a bit more than the 50 states, because it also includes the military locations of service and
regions and territories served by the U.S. Postal Service:
states.json
1 Comments:
At July 13, 2008 11:51 AM ,
Jamieson said...
License: All of the JSON tables downloadable in this post have been placed in the public domain.
Do you need a public information source that I don't cover here?
Post a Comment
<< Home