Check if a GPS Lat/Lng point lies on a road in Google maps

帅比萌擦擦* 提交于 2019-12-10 18:23:58

问题


I'm developing a navigation app in android. I want to prompt the user when he goes off-road. So, if I have a GPS Lat/Lng point, is it possible to determine if that point lies on a road or not? Is there any API support for such checks? This is to be done on all roads in general and not while having a specified path/polyline.


回答1:


You can use the isLocationOnPath() function for that. You have to add the dependency

dependencies {
    compile 'com.google.maps.android:android-maps-utils:0.4+'
}

in your app gradle file. For more information http://googlemaps.github.io/android-maps-utils/#start



来源:https://stackoverflow.com/questions/12208728/check-if-a-gps-lat-lng-point-lies-on-a-road-in-google-maps

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