As part of a development project I have to implement a search feature that will return the people 'within 10, 20, 50' miles sort of thing. I have managed to find an open source post code database (http://www.kubelabs.com/ukpostcodedata.php) that has latitiude and longitude details so should suffice. I know i need to use basic trigonometry to get the distance between points based on the latitudes and longitudes which is all good.
What i'm curious about is that it seems wasteful to me that if someone chooses for example, 'within 30 miles' and their location is Edinburgh, that the script would check every line of the database completely. Is this the only way to do it? Sorry if it is a stupid question but feel free to enlighten me anyways.
What i'm curious about is that it seems wasteful to me that if someone chooses for example, 'within 30 miles' and their location is Edinburgh, that the script would check every line of the database completely. Is this the only way to do it? Sorry if it is a stupid question but feel free to enlighten me anyways.
