Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/267.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何找到两个经纬度的中心点?_Php - Fatal编程技术网

Php 如何找到两个经纬度的中心点?

Php 如何找到两个经纬度的中心点?,php,Php,我有两个纬度,经度,现在我怎样才能找到中心纬度,这两个纬度经度的经度。 有人能帮我吗?为你定义什么是“中心”。大多数情况下,我使用简单平均值。更好的解决方案是从地球中心计算两个矢量,将它们相加,并将结果归一化 为你定义什么是“中心”。大多数情况下,我使用简单平均值。更好的解决方案是从地球中心计算两个矢量,将它们相加,并将结果归一化 将纬度和经度转换为弧度,然后 $deltaLongitude = $endPointLongitude - $startPointlongitude; $xModi

我有两个纬度,经度,现在我怎样才能找到中心纬度,这两个纬度经度的经度。
有人能帮我吗?

为你定义什么是“中心”。大多数情况下,我使用简单平均值。更好的解决方案是从地球中心计算两个矢量,将它们相加,并将结果归一化

为你定义什么是“中心”。大多数情况下,我使用简单平均值。更好的解决方案是从地球中心计算两个矢量,将它们相加,并将结果归一化

将纬度和经度转换为弧度,然后

$deltaLongitude = $endPointLongitude - $startPointlongitude;

$xModified = cos($endPointLatitude) * cos($deltaLongitude);
$yModified = cos($endPointLatitude) * sin($deltaLongitude);

$midpointLatitude = atan2(
    sin($startPointlatitude) + sin($endPointLatitude),
    sqrt((cos($startPointLatitude) + $xModified) * (cos($startPointLatitude) + $xModified) + 
         $yModified * $yModified
    )
);
$midpointLongitude = $startPointLongitude +
    atan2($yModified, 
        cos($startPointLatitude) + $xModified
    );

将纬度和经度转换为弧度,然后

$deltaLongitude = $endPointLongitude - $startPointlongitude;

$xModified = cos($endPointLatitude) * cos($deltaLongitude);
$yModified = cos($endPointLatitude) * sin($deltaLongitude);

$midpointLatitude = atan2(
    sin($startPointlatitude) + sin($endPointLatitude),
    sqrt((cos($startPointLatitude) + $xModified) * (cos($startPointLatitude) + $xModified) + 
         $yModified * $yModified
    )
);
$midpointLongitude = $startPointLongitude +
    atan2($yModified, 
        cos($startPointLatitude) + $xModified
    );

另外,要注意经度。170°E和170°W处两点之间的中点应位于180°E或W处,但最终可能为0°E


从美国地质调查局下载约翰·p·斯奈德的《地图投影:工作手册》。它是免费的。

另外,注意经度。170°E和170°W处两点之间的中点应位于180°E或W处,但最终可能为0°E


从美国地质调查局下载约翰·p·斯奈德的《地图投影:工作手册》。它是免费的。

您使用的是哪种投影?这非常简单,只需将纬度和除以2相加,类似于经度和除以2相加。例如,您可以使用搜索;你使用的是哪种投影?这很简单,只需将纬度和除以2相加,类似于经度和除以2相加;很明显,我在否决票中错了:任何人都愿意解释,这样我也可以向大师学习+1,因为我尝试了一下。我不想让人头痛,而是因为黎曼圈——现在,令人兴奋的责任数学开始发挥作用了。谢谢,看起来像是更多的阅读和沉重的数学这里有一个参考,很明显我在投票中错了:有人愿意解释,以便我也可以向大师学习+1。我不想让人头痛,这是因为黎曼圈——现在,令人兴奋的数学任务开始发挥作用了。谢谢,看起来像是更多的阅读和沉重的数学这里有一个参考