Need a zip locator feature on a site. Where to start?
So I have been tasked to create a site which has a dentist 开发者_运维百科locator based on the zip code inputted. There will be 8 dentists that will be available. I will probably set up a table in a mysql database to hold the information on the dentists (more will be added in the future).
I just don't really know how to get started. I know it cant be all to hard to implement because soo many sites have it. Is there any free open source ways of doing this? If I need to pay for some sort of zip database, so be it.
Any pointers would be appreciated.
I should add: I will be using php/mysql/jquery. The local is USA.
Here is the database you need, zip codes with lat/long co-ordinates http://sourceforge.net/projects/zips/files/
and here is how you would implement "find the zip codes within x miles of given zip code" (believe it is written in VB)
http://www.wwwcoder.com/Default.aspx?tabid=68&site=3551&parentid=451&type=art
Python Implementation: http://code.activestate.com/recipes/393241/
Math background: http://www.meridianworlddata.com/Distance-Calculation.asp
Once you get this result set, you would match the doctors who are in these zip codes
Best of luck!!
Edit: My suggestion is you use your DB to return you the list of zip codes within "x" miles of a given zip code rather than doing it in PHP. Extending this, you can have a stored proc/function which can return a list of doctors within x miles of a given zip code. You might also want to handle pagination accordingly (if you are using pagination) (Limit & offset ,I guess in MySQL. might be wrong, its a long time since I used it)
精彩评论