I need to implement a locality based search feature where users would be able to choose a city and locality(within the city) , proceed to mention a keyword and click on search . So say we have 10 cities with an average of 100 localities in each . The results are to be displayed considering the user provided locality as the starting point and ordering other results further away from the user's locality (in this way the cities results for the particular keyword would be constant only the ordering would change ) .What would be the best approach in php ?
1) Calculate the distance between various localities , pre store them in the mySqldatabase . This would mean a 100X100 matrix for the localities (each localities distance from the others).Also as many tables as the cities in the db . So 10 such tables + possibility of adding more . This is to be used only for ordering.
2) Put all the data in an XML instead of mysql database.
3) Use bitmaps and compressed images ?
Considering performance and scalability as a main criteria .