I have a list of about 60 stores with physical addresses and geocodes. I would like to make a simple interface where a user can enter a zip code, or city and state, or even a street address and have the list sort in order of proximity to the entered address. This is a very common feature of websites as I understand.
My plan to do this is to use the Google Maps API to find the geocode of the entered location and use the Pythagorean Theorem to calculate the distance from each location and sort the list by the distances and return the result (or maybe the top 5 of the result set...).
Is this the correct way to do this? Is there a more optimal method or a function built-in the Google Maps API that will do this? Since this is something so common, I would imagine there has been tried and tested in many ways and there are probably several correct answers. I am just looking for some advice if I am going about this the correct way.
Thank you.