Reputation: 1109
I was using Google Maps Javascript API (GWT Maps V3 API) to some poly line in Google Maps. There are some poly line that overlap each other like in this picture:
As we can see from the picture above, there are two poly line blue and purple that overlap each other (they have the same path). Then add a red poly line among those two poly line like this:
Now I need to get all poly line that overlap / intersect with the red poly line. Is there any way I could do this in Google Maps Javascript API? Any comment and answer will be appreciated. Thanks and regards.
Upvotes: 2
Views: 2299
Reputation: 8439
You could use geometry library
isLocationOnEdge(point:LatLng, poly:Polygon|Polyline, tolerance?:number)
To determine whether a point falls on or near a polyline, or on or near the edge of a polygon, pass the point, the polyline/polygon, and optionally a tolerance value in degrees to google.maps.geometry.poly.isLocationOnEdge(). The function returns true if the distance between the point and the closest point on the line or edge falls within the specified tolerance. The default tolerance value is 10-9 degrees.
Upvotes: 4