緯度、距離範囲に基づいてランダム緯度をとる

406 ワード

/*
$lat   
$lon   
$d       
$d2      
*/
function latlog($lat,$lon,$d,$d2)
		{
		     
			 $angle=rand(1,360);
			 $nd=rand($d,$d2);
            //             
			 $lon = $lon + ($nd * sin($angle* pi() / 180)) / (111 * cos($lat * pi() / 180));
            //             
   		 	 $lat = $lat + ($nd * cos($angle* pi() / 180)) / 111;
		     return $lat.",".$lon;
		}