Jump to content

Post code algorithim


c_pattle

Recommended Posts

I have some data that the user can search by using their post code.  I want to results to be relevant to the users postcode.  For example the user can search through local events by their post code and I want to data returned to be near their postcode.  So if the user looks for events near Manchester I want it to return the surround area e.g Manchester, Leeds etc. 

 

Although I think for this I'm going to need some kind of algorithm.  Has anyone done something like this in the past and could point me in the right direction? 

 

Thanks for any help. 

Link to comment
Share on other sites

Well in sorts you will need an algorithm. But what your going to need access to first is a post code database that has something like longitude and latitude references along side the rest of the post code information ("rest of being" actual town name, state, country, other..) Then you need to device database queries based on both user end provided data and server side data.

 

IE user-A comes along wants to see tickets from "06109, Hartford, CT, US" user-A wants info on tickets within 50 miles of their location. So you query the DB for the zipcode, get the longitude and latitude apply a little bit of math to the equasion to find the 50 mile radius, then requrey the database for longitudes and lattidues that fall within that area.. From there you would have to compare that to your events table each event having at the least longitude and latitude references for comparison from your first set of queries.

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.

Guest
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.