Getting the nearest street/road coordinates in android

南笙酒味 提交于 2019-12-06 06:51:27

问题


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. Using some TravelMode alternative, get coordinates approximated to nearest street/road.

  2. 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:

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.


回答1:


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

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

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

See my answer here.



来源:https://stackoverflow.com/questions/18607180/getting-the-nearest-street-road-coordinates-in-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!