I'm in the process of developing the idea for a website and i need the ability for people visiting the site to a search based on location - a bit like you get on a dating site or a job site where you say i want something in location x, what is in location x and what is within say (for example) 5 miles, 10 miles etc. How is such a system created? Surely every distance between every single location cannot be measured and put into the database? I'm just looking for a general answer (not a programming answer). Any ideas, if someone could shed light on how it is done that would be great.
I have never worked on one myself, but I am fairly certain such systems are based upon latitude and longitude algorithms. E.g. when company XYZ is added to the database, the latitude and longitude for the location are stored based on this you can then calculate the mileage distance from search to location. I Google'd and found this script which may help with the algorithm side of things: http://www.goldsofts DOT com/script/606/13409/Geographic_Distance_and_Azimuth_Calculations.html However I am not sure how you go about obtaining the latitude and longitude for where the company XYZ is. I also found this article (2 Parts) which may be helpful: http://blog.ocfoodreview DOT com/2006/06/29/notes-on-implementing-location-based-search-part-1-of-2/ Note you have to replace the DOT with a dot as I am too new to the forum to post working URL's. HTH
Thanks silkysmooth, ill take a look - at the end of the day i won't be doing the scripting, ill be paying someone to create a search facility, at this stage im just interested to know how complex it will be to do... Anyone else...?
You can use ZIP codes - you enter them along with the (average) latitude and longitude, calculating distances from that should be quite easy. Moreover if you let users enter their details they'll for sure know their ZIP code, while it's a bit tougher to ask them for their lat and lng...
There's a script for this (US & Canada however) which is very easy to use. I haven't seen one for the UK but I'm sure it can be done. Actually I just did a quick search and found this : http://www.milldo.com/en16_uk_post_codes_database.htm But it is quite expensive so you can probably take your time and look for something similar.
Thanks thats a great link i've book marked it for future reference and $100 isn't really too much for that amount of data (as long as it works at the end of the day) - i mean im looking at a budget of $1000-$2500ish for the entire project; although that obviously depends on quotes. The search facility is just part of the site im developing... will be outsourcing the coding etc to someone on rentacoder most probably...
I haven't downloaded the file so I can't tell if it's good or not, but this seems free and easier to use to calculare distances: http://www.easypeasy.com/guides/article.php?article=64 HTH, cheers!