最佳答案
您可以使用 Great-circle_distance计算得到的分数。
我首先从所需的中心点计算方位角,然后 foreach 循环它们并将它们传递给函数。
function destinationPoint($lat, $lng, $brng, $dist) {
$rad = 6371; // earths mean radius
$dist = $dist/$rad; // convert dist to angular distance in radians
$brng = deg2rad($brng); // conver to radians
$lat1 = deg2rad($lat);
$lon1 = deg2rad($lng);
$lat2 = asin(sin($lat1)*cos($dist) + cos($lat1)*sin($dist)*cos($brng) );
$lon2 = $lon1 + atan2(sin($brng)*sin($dist)*cos($lat1),cos($dist)-sin($lat1)*sin($lat2));
$lon2 = fmod($lon2 + 3*M_PI, 2*M_PI) - M_PI; // normalise to -180..+180º
$lat2 = rad2deg($lat2);
$lon2 = rad2deg($lon2);
echo "lat = ".$lat2."\n";
echo "lon = ".$lon2."\n\n";
}
$lat = 0;
$lng = 0;
$dist = 1; // km
$n = 12;
$bearings = range(0, 360-(360/$n) , 360/$n); // create array of all bearings needed from $lat/$lng
foreach($bearings as $brng){
echo $brng ."\n";
destinationPoint($lat, $lng, $brng, $dist);
}
理论上,根据您需要的准确度,您只需要使用该函数计算出一半的值,然后您应该能够通过基本计算计算出另一半。
但如果距离很大(不知道究竟是什么意思),它可能会有所不同。
关于php - 如何获取围绕中心坐标和半径的N个坐标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50133937/