计算从纬度和经度到路线 google 地图 api 的距离(以公里为单位)

calculating distance in km from latitude and longitude to route google map api

我使用 google 地图 api 3.

从位置 A 到位置 B 的路线中间很少有人站着

现在我想找出哪些人(我们有他们的 GPS 坐标)在该路线附近。

我怎样才能找到这个。

使用几何库。

https://developers.google.com/maps/documentation/javascript/reference#poly

静态方法isLocationOnEdge()

Computes whether the given point lies on or near to a polyline, or the edge of a polygon, within a specified tolerance. Returns true when the difference between the latitude and longitude of the supplied point, and the closest point on the edge, is less than the tolerance. The tolerance defaults to 10-9 degrees.

您必须在 API 调用中包含该库:

http://maps.google.com/maps/api/js?libraries=geometry