dongqiu7365 2019-05-27 16:50
浏览 73

如何计算多个纬度和经度坐标的距离?

I have the following arrays:

$latitude = ['9.9663755','10.1883153','9.9689272','10.1109653' ,'10.1883153','10.1883153']
$longitude = ['76.288569','76.4512288','76.2890601','76.3541268','76.4512288','76.4512288']

How do I get the total distance travelled with these points.

  • 写回答

1条回答 默认 最新

  • dongsuichi6529 2019-05-27 17:09
    关注

    Except for the array handling this is a duplicate of Measuring the distance between two coordinates in PHP (to calculate the distance). I would suggest something like:

    $dist=0;
    $alen=count($latitude);
    
    for ($i=1;$i<$alen;$i++) {
       $lat=$latitude[$i];
       $lon=$longotude[$i];
       $frlat=$latitude[$i-1];
       $frlon=$longotude[$i-1]
      // calculate distance according to the link above
      // pass in $frlat, $frlon and $lat, $lon to determine a single
      // segment distance. store in $calcdist)
      $dist+=$caldist;
      $llat=$lat;
      $
    }
    
    评论

报告相同问题?

悬赏问题

  • ¥15 jupyterthemes 设置完毕后没有效果
  • ¥15 matlab图像高斯低通滤波
  • ¥15 针对曲面部件的制孔路径规划,大家有什么思路吗
  • ¥15 钢筋实图交点识别,机器视觉代码
  • ¥15 如何在Linux系统中,但是在window系统上idea里面可以正常运行?(相关搜索:jar包)
  • ¥50 400g qsfp 光模块iphy方案
  • ¥15 两块ADC0804用proteus仿真时,出现异常
  • ¥15 关于风控系统,如何去选择
  • ¥15 这款软件是什么?需要能满足我的需求
  • ¥15 SpringSecurityOauth2登陆前后request不一致