如何使用 Google 地图检测或检查折线是否在另一条折线内或与其他折线重叠
How to detect or check whether a Poly Line was Inside Another Poly Line or Overlap with Other Poly Line Using Google Maps
我正在使用 Google 地图 Javascript API(GWT 地图 V3 API)到 Google 地图中的一些折线。有一些折线相互重叠,如下图所示:
从上图可以看出,蓝色和紫色两条折线相互重叠(路径相同)。然后在这两条多边形线之间添加一条红色多边形线,如下所示:
现在我需要获取所有与红色多边形线重叠/相交的多边形线。有什么办法可以在 Google 地图 Javascript API 中做到这一点?任何评论和回答将不胜感激。谢谢和问候。
你可以使用 geometry library
isLocationOnEdge(点:LatLng,poly:Polygon|折线,公差?:数字)
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.
我正在使用 Google 地图 Javascript API(GWT 地图 V3 API)到 Google 地图中的一些折线。有一些折线相互重叠,如下图所示:
从上图可以看出,蓝色和紫色两条折线相互重叠(路径相同)。然后在这两条多边形线之间添加一条红色多边形线,如下所示:
现在我需要获取所有与红色多边形线重叠/相交的多边形线。有什么办法可以在 Google 地图 Javascript API 中做到这一点?任何评论和回答将不胜感激。谢谢和问候。
你可以使用 geometry library
isLocationOnEdge(点:LatLng,poly:Polygon|折线,公差?:数字)
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.