I try to get the 10 closest Markers from the center of the google map and sort them based of the center by distance in Javascript. So lets say i have 100 Markers in a Javasc
Whatever happens You need to calculate all distances. You can do it yourself with simple equations or use Google's geometry library: http://code.google.com/intl/pl-PL/apis/maps/documentation/javascript/geometry.html and its function: computeDistanceBetween(). Then store distance in custom marker property like e.g:
marker.distance = google.maps.geometry.spherical.computeDistanceBetween(marker.position, center.position);
and sort it anyway you want. Hope it helps.
sort()
.slice()
.