获取最近的街道/公路的android坐标 [英] Getting the nearest street/road coordinates in android

查看:210
本文介绍了获取最近的街道/公路的android坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在JavaScript中,使用谷歌地图API 取值我们指定选项,如 google.maps.TravelMode.DRIVING 。难道我们在Android的任何等价物 TravelMode ?我看不到任何东西 android.location.LocationManager android.location.Criteria 我认为以下选项:

In javascript, using Google maps apis we specify options such as google.maps.TravelMode.DRIVING. Do we have any equivalent for TravelMode in android? I couldn't see anything in android.location.LocationManager or android.location.Criteria I've thought of following options:

  1. 使用一些 TravelMode 的替代,得到坐标的近似的,以最近的街道/公路。

  1. Using some TravelMode alternative, get coordinates approximated to nearest street/road.

另外,(不pferred因为这将是$ P $缓慢的)得到的坐标通常并可能将其发送给一些谷歌的API(这将是pretty的慢如有许多点),并获得校正到最近街道的坐标的坐标。或者在情况下,如果存在一些(谷歌-地图)javascript框架,它可用于获得相应街道坐标

Alternatively, (Not preferred as it will be slow) get the coordinates normally and then probably send it to some google api(This will be pretty slow as there are many points) and get the coordinates corrected to the nearest street coordinates. Or in case if there exists some (google-maps) javascript framework, it may be used to get corresponding street coordinates.

EDIT1:

我也看着这个。因此成 android.location.Geo codeR 。该 getFromLocation 在这个类似乎做的大部分工作。但是,我怕一个额外的延迟,而获得的最近地址。

I've also looked into this. and hence into android.location.Geocoder. The getFromLocation in this class seems to do most of the work. However, I'm afraid, of an additional delay while acquiring the nearest address.

推荐答案

如果你是指的路线服务,然后使用谷歌路线API 内部如上述概述:

If you are referring to Directions Service, then it uses Google Directions API internally as stated in the overview:

该对象与谷歌地图API路线服务接收方的请求,并返回计算结果进行通信。

This object communicates with the Google Maps API Directions Service which receives direction requests and returns computed results.

由于有是Android的原生API还没有的话,建议直接使用方向API。

As there is no native API for Android yet, I suggest using Directions API directly.

请参阅我的回答<一href="http://stackoverflow.com/questions/15834357/how-do-i-add-markers-to-streets-only-android-development/15837303#15837303">here.

这篇关于获取最近的街道/公路的android坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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