ghost...
ghost...

Reputation: 1001

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

I have few people stand in between a route from Location A to Location B using google map api 3.

Now i want to find out which all people(we have their GPS coords) are near to that route.

How can i find this.

Upvotes: 1

Views: 1070

Answers (1)

MrUpsidown
MrUpsidown

Reputation: 22489

With the Geometry Library.

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

Static method 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.

You have to include the library in your API call:

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

Upvotes: 2

Related Questions