I think it’s easier and more accurate to get markers within the actual boundaries, not the radius. You can easily expand or reduce borders if you want.
JavaScript:
var bounds = map.getBounds();
var sw = bounds.getSouthWest();
var ne = bounds.getNorthEast();
var s = sw.lat();
var w = sw.lng();
var n = ne.lat();
var e = ne.lng();
PHP / SQL:
$query = "SELECT * FROM Markers WHERE ";
if ($w > $e) { // If the bounds include the intl. date line
$query .= "(lat BETWEEN $s AND $n) AND ((lng BETWEEN -180 AND $e) OR (lng BETWEEN $w AND 180))";
} else {
$query .= "(lat BETWEEN $s AND $n) AND (lng BETWEEN $w AND $e)";
}
, - :
var w = map.getBounds().getSouthWest().lng();
var centerLng = map.getCenter().lng();
var distance = centerLng - w;