Whatever happens, you need to calculate all the distances. You can do it yourself using simple equations or use Google geometry: http://code.google.com/intl/pl-PL/apis/maps/documentation/javascript/geometry.html and its function: computeDistanceBetween (). Then save the distance as a custom marker, for example, for example:
marker.distance = google.maps.geometry.spherical.computeDistanceBetween(marker.position, center.position);
and sort it anyway. Hope this helps.
source share