/**
* @param lat 纬度 lon 经度 raidus 单位米
* return minLat,minLng,maxLat,maxLng
*/
function getAround($lat,$lon,$raidus){
$PI = 3.14159265;
$latitude = $lat;
$longitude = $lon;
$degree = (24901*1609)/360.0;
$raidusMile = $raidus;
$dpmLat = 1/$degree;
$radiusLat = $dpmLat*$raidusMile;
$minLat = $latitude - $radiusLat;
$maxLat = $latitude + $radiusLat;
$mpdLng = $degree*cos($latitude * ($PI/180));
$dpmLng = 1 / $mpdLng;
$radiusLng = $dpmLng*$raidusMile;
$minLng = $longitude - $radiusLat ;
$maxLng = $longitude + $radiusLng;
return array(
'var1'=>$minLng,
'var2'=>$maxLng,
'var3'=>$minLat,
'var4'=>$maxLat,
);
}
$squares = getAround($lang,$lat,400);
print_r($squares['var1']);
print_r($squares['var2']);
print_r($squares['var3']);
print_r($squares['var4']);