Part of the EllisLab Network
   
 
A Good Zip Code Database Schema
Posted: 02 January 2009 11:52 PM   [ Ignore ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  494
Joined  07-16-2008

I found a couple of them but I was wondering if anyone knows a more current copy of the USA (or even better “western world”) zipcodes. free-zipcodes.com has a descent(?) copy from 2006 - but I don’t want to start with it if there is something better.

I also found these:
micahcarrick.com
phpclasses.com/522
phpZipLocator
populardata

From Elvix

Another solution to buying a Zip code DB is to use Google Map’s geocoder. I extracted the geocoding functions from a CI-enabled Google Maps API library I found, and just do queries for the Zips as they’re needed, saving the results in a DB table so I don’t have to look them up again. Works great and handles US, Canada, Japan, Europe—well, anywhere Google goes. - http://codeigniter.com/forums/viewthread/78436/#393541

Anyone have some advice?

 Signature 

My Blog, C2D, PHP Videos, CXTags, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 04 January 2009 05:30 AM   [ Ignore ]   [ # 1 ]  
Lab Assistant
RankRank
Total Posts:  155
Joined  06-06-2007

Firstly Welcome to CI Xeonross.

The problem with getting postal code information (thats zip codes, post codes, zonal codes), is it is usually owned by the mail service. In the United States thats the USPS, and in the UK its the Royal Mail.

In the UK we have the ability to pay for various ways to access this data, we can get the full PAF file for a few £k’s or you can pay a 3rd party, a few pennies for every lookup you want to do.

The US is different and im sure there is a web service for US info. It depends how much info you want.

For city and state look at

http://www.webservicex.net/uszip.asmx?op=GetInfoByZIP

 Signature 

Codeigniter - Saving Kittens from Drupal

Web Construction Engineer - NPC Digital - My Site

Profile
 
 
Posted: 05 January 2009 10:38 AM   [ Ignore ]   [ # 2 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  494
Joined  07-16-2008

Thanks, but for now I would rather skip the pay-per-use services as this isn’t worth any cash yet.

Also, thanks for the welcome. wink

 Signature 

My Blog, C2D, PHP Videos, CXTags, Super .htaccess, Extra hooks, and MicroMVC

Profile
 
 
Posted: 20 June 2009 12:10 AM   [ Ignore ]   [ # 3 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  633
Joined  03-21-2009

@Xeoncross… did you ever settle on a zip code database?  I’m in the market as well.  I thought I had a good one but I just noticed it’s missing some and I can’t tell how many.  I plan to use the free-zipcodes.com table unless you’ve found something better.  Thanks.

Profile
 
 
Posted: 30 June 2009 01:17 AM   [ Ignore ]   [ # 4 ]  
Summer Student
Total Posts:  5
Joined  03-15-2009

Hello,

I am new here to the forums as well as CI, but I am finding it to be very useful.

I noticed this thread about zip codes and figured I would give you what I have in hopes
it will be some help to you.

In the zip file you will find US zip codes something like 42,624 I believe it is complete.
Also I have included the Zipcode.php class that was listed in the wiki on this site.
I have modified the class to work with the database I have attached here. I hope this helps
those of you in need.

To use the class upload it to the library folder and call like so in your controller:

$this->load->library('zipcode'); 

After it has been loaded you can use it like this:

// Get the zip codes in range my miles
$this->zipcode->get_zips_in_range('92505''10');

// Get the distance between two zip codes
$this->zipcode->get_distance('92505''92555');

// Get the points for a zip code lat and lon
$this->zipcode->get_zip_point('92557');

// Get the zip details, lat, lon, city, stateprefix, state, county, areacode, timezone
$this->zipcode->get_zip_details('92557'); 

I think that pretty much sums it up. Again I hope this is some help to
those of you that were looking for a solution like myself.

Link to files: Download zip file

Regards,
Ray

 Signature 

Ray Cuzzart II
Ideal Web Solutions, LLC.
Website: Idealws.com
Automotive Product: InvenTrack
2-Way Web Text: Site2Text.com
Coming Soon: TheCarShopper.com

Profile
 
 
Posted: 09 October 2009 02:01 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Rank
Total Posts:  46
Joined  04-02-2008

Thanks for sharing that zipcode database.  It’s exactly what I needed!

Profile
 
 
Posted: 16 October 2009 03:32 PM   [ Ignore ]   [ # 6 ]  
Grad Student
Rank
Total Posts:  46
Joined  04-02-2008

I needed a database table that would allow me to lookup the timezone based off of a US zipcode, and idealws provided table almost did that.  It had a timezone field, but they weren’t true timezone ids that are required to use PHP 5 built in timezone functions. (i.e. were Eastern instead of America/New_York)

So I took the time to change all the timezones so that they are true timezone id labels. 

Here is the database table (MySQL) in case anybody else could benefit from it.

Download US Zipcode Table (PHP 5 timezone labels)

Profile
 
 
Posted: 19 March 2010 01:55 AM   [ Ignore ]   [ # 7 ]  
Summer Student
Total Posts:  1
Joined  03-19-2010

ZIPCodeWorld.com has a free download for their US ZIP code database. You can get it at http://www.zipcodeworld.com/zipcodefree.htm .

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 819, on March 11, 2010 11:15 AM
Total Registered Members: 149964 Total Logged-in Users: 38
Total Topics: 103610 Total Anonymous Users: 5
Total Replies: 518110 Total Guests: 419
Total Posts: 621720    
Members ( View Memberlist )