Click to See Complete Forum and Search --> : Zip Code Search on Website to Locate Members Closest


angel198561
01-20-2006, 07:22 PM
Okay you know how when you go to a company website and they have a store locator where you enter in your zip code or city and it finds the closes store too you?? On our website we have a member directory and at times we need to find out which member is the closest to a certain zip code or city. The member directory all ready has this information but you would have to search through all of the entries and that is becoming time consuming. How do you put a locator that will search these entries for you and return the closest people to a location?? Thanks in advance.

NogDog
01-20-2006, 11:20 PM
You'd probably need a database of zipcodes with the latitude and longitude for each. Then you'd probably do a query of all zip codes whose latitude is within x minutes of latitude and y minutes of longitude of the zip code of interest. Then you'd loop through each of those and do some spherical trigonometry to determine which of them is within the desired distance of the zip code of interest.