问题
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