I am trying to re-route my directions on Google Maps but there is an issue with me that I am not sure when I have to re-route the route.
So anyone tells me that how to detect that a geo point is inside a draw polyline or not??
Because when that point will land outside that polyline I can easily re-route my directions.
Thanks in advance,
you can do it with a support (almost official) library:
https://github.com/googlemaps/android-maps-utils
You can find your method in the class com.google.maps.android.PolyUtil by using:
public static boolean isLocationOnPath(LatLng point, List<LatLng> polyline,
boolean geodesic, double tolerance)
You can compute if the location is on the path. Geodesic true-false depends on your location and size of path, i'd usually set to false (since it's a route). Tolerance is how many meters from the path are accepted, if you put for example 5, you'll get true if the point is within 5 meters from the path (to avoid rerouting for a single wrong point)!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.