Free City/State/Zipcode to Latitude/Longitude Database? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this questionIs there a standard database of records mapping city/state/zip to lat/lng? I found this database, and the USPS has a simple (no lat/lng) API, but is there another recommended alternative?
Update: Found this too: http://www.geopostcodes.com/
Just a small note. Most of these 3rd party city/state/zip to lat/lng databases are based on the US Census Tiger data. Start with the Census 2000, the zip code data was replaced with ZCTA - which is an approximation of zipcodes. Here's an explanation from the Census site (from 2011):
ZIP Code Tabulation Areas (ZCTAs™) are a new statistical entity developed by the U.S. Census Bureau for tabulating summary statistics from Census 2000. This new entity was developed to overcome the difficulties in precisely defining the land area covered by each ZIP Code®. Defining the extent of an area is necessary in order to accurately tabulate census data for that area.
ZCTAs are generalized area representations of U.S. Postal Service (USPS) ZIP Code service areas. Simply put, each one is built by aggregating the Census 2000 blocks, whose addresses use a given ZIP Code, into a ZCTA which gets that ZIP Code assigned as its ZCTA code. They represent the majority USPS five-digit ZIP Code found in a given area. For those areas where it is difficult to determine the prevailing five-digit ZIP Code, the higher-level three-digit ZIP Code is used for the ZCTA code. For more information, please refer to the ZCTA (FAQ) Frequently Asked Questions Web page.
The link below is an updated explanation (2013):
http://www.census.gov/geo/reference/zctas.html
The OpenGeoCode.Org team
ADDED 12/17/13: Our (FREE) state/city/zip dataset (CSV) can be found at the link below. It is derived from public domain "government" datasets:
http://www.opengeocode.org/download.php#cityzip
Google offers this as a lookup. Can you do ajax calls from your app?
It's called webservices. http://code.google.com/apis/maps/documentation/webservices/index.html
You'd want to use the Google Geocoding api. It's simple to use, make a call to this url: http://maps.googleapis.com/maps/api/geocode/json?address=sydney&sensor=false
Change "address=" to whatever you need (ie the city state and zip code)
It can also reply in xml. just change json to xml http://code.google.com/apis/maps/documentation/geocoding/
Example Result
{
"status": "OK",
"results": [ {
"types": [ "locality", "political" ],
"formatted_address": "Sydney New South Wales, Australia",
"address_components": [ {
"long_name": "Sydney",
"short_name": "Sydney",
"types": [ "locality", "political" ]
}, {
"long_name": "New South Wales",
"short_name": "New South Wales",
"types": [ "administrative_area_level_1", "political" ]
}, {
"long_name": "Australia",
"short_name": "AU",
"types": [ "country", "political" ]
} ],
"geometry": {
"location": {
"lat": -33.8689009,
"lng": 151.2070914
},
"location_type": "APPROXIMATE",
"viewport": {
"southwest": {
"lat": -34.1648540,
"lng": 150.6948538
},
"northeast": {
"lat": -33.5719182,
"lng": 151.7193290
}
},
"bounds": {
"southwest": {
"lat": -34.1692489,
"lng": 150.5022290
},
"northeast": {
"lat": -33.4245980,
"lng": 151.3426361
}
}
}
} ]
}
Then all you need to do is open up results[0].geometry.location.lat
, and results[0].geometry.location.lng
[EDIT 8/3/2015] The free non-commercial ZIP Code database I mentioned below has moved to softwaretools.com. Note: greatdata.com still has the premium ZIP Code data for enterprises.
Just a small note. Most of these 3rd party city/state/zip to lat/lng databases are based on the US Census Tiger data. [Andrew]
I'm a developer for a commercial ZIP Code Database company (GreatData). For low-end data, Andrew's recommendation is correct and if you know your way around census data, it's pretty easy to get it. Just know it may initially take some hours to get it right. If you prefer not to do the work yourself, you can get our free/non-commercial version here (it's pretty much what Andrew is suggesting with minor enhancements. It's updated every couple months).
For a really good explanation on what is missing in it (and more importantly, what's missing in most all low-end ZIP Code data that is based on census ZCTA data) versus a commercial grade, see here.
ps - regarding suggestions to use Google's API, I see this suggested a lot but unless you're displaying it in a google map, this violates Googles TOS. Specifically: "The Geocoding API may only be used in conjunction with a Google map; geocoding results without displaying them on a map is prohibited." You'll find StackOverFlow has several threads on those who's sites have been blocked.
Hope this is beneficial
This is an old thread, but I was looking for the same information recently and also came across this free database:
http://federalgovernmentzipcodes.us
Check out zcta. You can draw the geographic boundaries of a zip code using their data.
If you have a small number of US cities you can easily build up your own database from Google which gives you the co-ordinates straight on the search page without the need to follow any links, e.g. type:
chicago illinois longitude latitude
精彩评论