谷歌地图API V2如何找到最近的位置 [英] Google maps api v2 how to find the nearest location

查看:170
本文介绍了谷歌地图API V2如何找到最近的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的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个地点之间的距离,在一条直线上。你可以找到关于如何在这里使用一个这样的例子:<一href=\"http://stackoverflow.com/questions/17594924/how-to-get-straight-distance-between-two-location-in-android\">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?

但是,如果你不想让直线距离,而旅行的距离,我建议你看看这个问题,答案是:<一href=\"http://stackoverflow.com/questions/18310126/get-the-distance-between-two-locations-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?

这篇关于谷歌地图API V2如何找到最近的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆