Jump to content

neighbouring zip code database search


Recommended Posts



I'm building a business directory and want to include a search function so that when a zip code is entered results are returned for the zipcode and all the neighbouring zip codes.


I know its possible to use latitude and longtitude to create a radius search, however I only want to return results from zip codes which share a common border with the input zip.


I have been supplied some sample zipcode data from a mapping company. The full database is quite expensive, so I'd like to make sure I can actually use the information before I shell out for it.


Below are a few rows of sample data. The first field is the zip code, the second is the number of adjoining zip codes and the remainder is the neighbouring zip codes









I'm pretty lost on this one. If anyone has any ideas on how to setup the tables and perform the queries that would be appreciated.



Link to comment
Share on other sites

Thanks cmgmyr,


The script is the best example I've seen using lat/long. But the only  data I can obtain cheaply for Australian zipcodes is using the table above with the search zip, number of adjoining zips and the other adjoining zips.


The main problem I'm having with understanding how to set up the queries is that some zipcodes have three neighbours while other have anything up to ten neighbours, which means I'm going to have blank fields in my table.


Any ideas on how to set up the tables?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.