谷歌地图API V2如何找到最近的位置位置、最近、地图、API

由网友(跟自己说抱歉)分享简介:我正在使用的Andr​​oid谷歌地图API V2。我创建的XML解析器的公交车站。巴士站正在使用的标记显示。我需要找到用户的当前位置和(0.5公里半径为例)找到最近的位置(公交车站),最好自动完成。I am using Google maps api v2 in android. I have created xm...

我正在使用的Andr​​oid谷歌地图API V2。我创建的XML解析器的公交车站。巴士站正在使用的标记显示。我需要找到用户的当前位置和(0.5公里半径为例)找到最近的位置(公交车站),最好自动完成。

I am using Google maps api v2 in android. I have created xml parser for the bus stop. Bus stops are displayed using markers. I need to find the user's current location and find the nearest location (bus stop), best automatically (for example in a radius of 0.5 kilometer).

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

I tried to find a tutorial, but unfortunately I failed it. Thank you for your help.

推荐答案

有是地点类的distanceTo()方法,得到2个地点之间的距离,在一条直线上。你可以找到关于如何在这里使用一个这样的例子:How在Android中拿到两位置间的直线距离?

There is the distanceTo() method of Location class that gets the distance between 2 locations, in a straight line. You can find an example on how to use this here: How to get straight distance between two location in android?

但是,如果你不想让直线距离,而旅行的距离,我建议你看看这个问题,答案是:Get android系统中两个位置之间的距离?

But, if you don't want the straight line distance, rather the Travel distance, I'd recommend you take a look at this question and answer: Get the distance between two locations in android?

阅读全文

相关推荐

最新文章