How to know if a route intersects a point?

29 views
Skip to first unread message

Warchangel

unread,
Aug 30, 2011, 3:08:08 PM8/30/11
to google-map...@googlegroups.com
Hello,
I am using API V3 and I'm finding some difficulties trying to discover if a point is on a route.
My problem is the following:
I have two entities: a route (DirectionsRoute) and a point (LatLng);
And I need to know if the point is in the route = D

Is there an easy way to do this check?

I have not found anything like this in the documentation for directions, only for rectangles.

Thank you
Warchangel

geoco...@gmail.com

unread,
Aug 30, 2011, 6:17:36 PM8/30/11
to Google Maps JavaScript API v3
Not a function of the directions service. The best you can probably
do is find the distance of the point from the polyline returned by the
directions service, then set a threshold for "on the route" and detect
when the point is closer than that to the route.

I suppose you could try using that point as a waypoint in the route
and try to see how much the route changes, but that wouldn't be very
reliable.

-- Larry

>
> Thank you
> Warchangel
Reply all
Reply to author
Forward
0 new messages