When you determine the three closest locations, you’ll need to modify your data source by deleting all of the rows and then creating three new rows for that information and then refreshing the data source.
Finding the three closest locations is not a simple matter. I’ve done this using the Haversine formula: