c_pattle Posted August 3, 2010 Share Posted August 3, 2010 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. Quote Link to comment Share on other sites More sharing options...
monkeytooth Posted August 3, 2010 Share Posted August 3, 2010 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.