【问题标题】:Google maps api v2 how to find the nearest locationGoogle maps api v2如何找到最近的位置
【发布时间】:2014-05-06 14:18:42
【问题描述】:

我在 android 中使用 Google maps api v2。我为公交车站创建了 xml 解析器。巴士站使用标记显示。我需要找到用户的当前位置并找到最近的位置(公交车站),最好是自动(例如在 0.5 公里的半径内)。

我试图找到一个教程,但不幸的是我失败了。 感谢您的帮助。

【问题讨论】:

    标签: android google-maps-markers google-maps-android-api-2


    【解决方案1】:

    Location 类的 distanceTo() 方法可以获取 2 个位置之间的直线距离。您可以在此处找到有关如何使用它的示例:How to get straight distance between two location in android?

    但是,如果你不想要直线距离,而是旅行距离,我建议你看看这个问题和答案:Get the distance between two locations in android?

    【讨论】:

      猜你喜欢
      • 2016-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-05-11
      • 1970-01-01
      • 2013-08-27
      • 1970-01-01
      相关资源
      最近更新 更多