smartin1017 Posted August 1, 2009 Share Posted August 1, 2009 Hi Guys, I have a db that contains US zip codes, longitude and lattitude. I need to be able to find all zips that are within a certain radius of a chosen zip. I have tried a few different things but they all take up to a minute to find. I even tried creating a MySQL function to get the info but it is still taking more tehn 30 seconds to get results. There are over 41000 rows. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/168364-getting-radius-around-zip/ Share on other sites More sharing options...
Daniel0 Posted August 1, 2009 Share Posted August 1, 2009 http://en.wikipedia.org/wiki/Haversine_formula That will give you the distance between two points on a sphere, so you just select points that are do not have a greater distance from your initial point than the length of your radius. Quote Link to comment https://forums.phpfreaks.com/topic/168364-getting-radius-around-zip/#findComment-888153 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.