Reputation: 21
I have problems with android google map api v2.
I want to select a polyline from the map like I select a marker.
With a marker I use onTap
.
Is it possible to select a polyline?
Upvotes: 2
Views: 819
Reputation: 6356
Just use PolyUtil#isLocationOnPath(...)
from android map utils. It is exactly what you want.
Example:
googleMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
@Override
public void onMapClick(LatLng latLng) {
boolean isOnRoute = PolyUtil.isLocationOnPath(latLng, latLngs, true, tolerance);
// do what you want
}
}
Upvotes: 1
Reputation: 22232
You will have to write your own algorithm for that and do the checking in OnMapClickListener.
Upvotes: 0