I have a csv file of names, zip codes, and distances willing to travel. A web-user will input their zip-code and a mile radius of how far they are willing to search. And I'm looking for the names of people, within the csv file, that match that search. I'm not too familar with geolocation searching or free technologies that are currently available (such as google maps). The site is programmed in php and is using jquery. I do not want a map, just an array or tree of the names. Any suggestions on how to set this up?
CSV example
"1","John Smith","ZipCode-12345","TravelDistance-30"
Solution
- Setup a cronjob to grab csv file and dump in mysql db table
- Downloaded a db table of cities/states, lat/long, zipcodes
- Used sql formula to calculate the distances and queries the matches
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) )
* cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;