Guest Posted June 14, 2008 Share Posted June 14, 2008 Hi guys, never posted here before so not sure what part of the forum to put this question in. Basically I'm developing a community site which involves customers sorting through other users who are near them based on distance in miles, Now I have implemented this database and script - http://www.sloomedia.com/php_postcode_script.php But what I want to know is the theory behind converting this approach, which takes 2 postcodes and finds a distance (ive already converted from KM to miles as i'm making a UK site) to something that'll sort through all users and find users who are close to you, just like autotrader.co.uk does. Thing is , I can't fathom the theory behind it - surely i'd have to query every entry in the postcode database (2823 entries), checking distance between the postcode of the user and every other.. of course this is a ludicrous approach (right?!) as it'd be appallingly server intensive. So whats the solution, and how does autotrader do it do you think? Any help with this conundrum much appreciated! Cheers! Will G http://www.willgoldstone.com Link to comment https://forums.phpfreaks.com/topic/110246-sorting-users-for-proximity-via-postcode/ Share on other sites More sharing options...
Barand Posted June 14, 2008 Share Posted June 14, 2008 if you have a database of UK postcodes with their lat and long coordinates you can calculate the distances. http://www.phpfreaks.com/forums/index.php/topic,166487.msg733106.html#msg733106 Link to comment https://forums.phpfreaks.com/topic/110246-sorting-users-for-proximity-via-postcode/#findComment-565669 Share on other sites More sharing options...
Guest Posted June 16, 2008 Share Posted June 16, 2008 Hey thanks for your reply, but as you'll see from my original message , I already have distance calculation working fine - i'm looking to convert this to an approach that'll find people by their postcode when a user specifies their own, like autotrader.co.uk, or ebay i guess.. please re-read! cheers Will Link to comment https://forums.phpfreaks.com/topic/110246-sorting-users-for-proximity-via-postcode/#findComment-566318 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.