1

In a google map, I have drawn a route with 2 coordinates say (x1, y1) and (x2, y2). Now if we consider a coordinate as (a,b), how can we determine if that coordinated belongs to the route drawn.

X1 - Latitude Y1 - Longitude

I have tried line equation for this, however it is failing.

public static bool AmIOnTheLine(Point start, Point end, Point location)
        {
            ////Line equation
            var slope = (start.Y - end.Y) / (start.X - end.Y);

            //y = mx + b
            //b is y intercept
            double yIntersect = start.Y - slope * start.X;

            var result = slope * location.X + yIntersect;
            if(result == location.Y)
                 return true;

            return false;
        }

I have multiple paths drawn on a map.

VJOY
  • 3,752
  • 12
  • 57
  • 90
  • http://stackoverflow.com/questions/15315347/google-maps-api-to-get-bus-route?answertab=votes#tab-top – C Sharper Jan 06 '14 at 06:47
  • http://stackoverflow.com/questions/12277645/how-do-i-obtain-the-coordinates-along-gmaps-directions?answertab=votes#tab-top – C Sharper Jan 06 '14 at 06:50

0 Answers0