【问题标题】:how to find the distance from current location to given location?如何找到从当前位置到给定位置的距离?
【发布时间】:2011-06-08 12:22:46
【问题描述】:

我正在开发一个与地图相关的应用程序。

通过使用它,我想开发一个代码来查找从当前位置到给定位置的距离,获取从当前位置到给定位置的路线,并获得从当前位置到达给定位置的估计时间。

【问题讨论】:

    标签: android google-maps


    【解决方案1】:

    你得到两个位置之间的距离如下:

    location1.distanceTo(location2);
    

    结果以米为单位,作为浮点数。但这是乌鸦飞翔的距离。

    要获取两个位置之间的路线,包括该路线的距离和行程时间,您需要使用Google Directions API

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-05-18
      • 2017-05-15
      相关资源
      最近更新 更多