You can use, for example, PolyUtil.isLocationOnPath(LatLng point, java.util.List<LatLng> polyline, boolean geodesic, double tolerance)
from Google Maps Android API Utility Library . In this case you need to iterate over each point of the "red" polyline and check (with isLocationOnPath()
) if it intersects (lays on) each segment of the "blue" polyline. Something like that:
for (LatLng point : redPolyline.getPoints()) {
if (PolyUtil.isLocationOnPath(point, bluePolyline.getPoints(), true, 50)) {
// now "point" - is your target point
pointWhatYouWantToGet = point;
...
}
}
where 50
- is tolerance (in meters).
If you need polylines segments intersection, take a look at this answer of antonio .
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.