I'd take sample points, for example, about 10 or 20 points devided evenly over the polyline and calculate from there, then at the shortest point, take another 10 or 20 points around the found point. That way you should be able to make a rather good guess on what the fastest way would be.
2008/11/29 danielb <[EMAIL PROTECTED]> > > mmm... it is not exactually what I mean. Let me explain. > Right now, the class find the closest point on the polyline to the > mouse, and snap the marker to it.. It is calculated by the shortest > straight line from the mouse point the the polyline. But in the reall > drive, we don't drive it straight lines. I would like the mareker to > snap to the point with the shortest route. > Now, I thought about passing thuorgh every point in the polyline, > create a Gdirection from it to the mouse point, and find the shortest. > I just think it is going to take a lot of time, becuase for examle, > the route in the exmaple have 504 points... > > Do you have any idea? > Thanks! > daniel > > On 29 נובמבר, 21:19, "Björn Brala" <[EMAIL PROTECTED]> wrote: > > That depends on when you would like that information. When the route is > > generated the information is available in the directions class. > > > > The SnapToRoute class can also give the idstance along the line (of the > > snapped marker) > > > > http://gmaps-utility-library.googlecode.com/svn/trunk/snaptoroute/1.0... > > > > http://gmaps-utility-library.googlecode.com/svn/trunk/snaptoroute/1.0... > > > > 2008/11/29 danielb <[EMAIL PROTECTED]> > > > > > > > > > > > > > the actual miles you need to drive... > > > and by the way, the SnapToPoint is really helpfull! thanks you very > > > much for realising it... > > > > > Daniel > > > > > On 29 נובמבר, 20:12, "Björn Brala" <[EMAIL PROTECTED]> wrote: > > > > Glad to see the snap to route class in the wild ^^ > > > > > > Anyways, im not sure what you mean with "realistic" point? > > > > > > 2008/11/29 danielb <[EMAIL PROTECTED]> > > > > > > > hi, > > > > > I made this map: > > > > >http://kaloot.co.il/map/map3.html > > > > > that find the nearst point on the route from the mouse, and on > click > > > > > find the route to this point. > > > > > now, it working, but not perefect. I want to find the nearst > > > > > "realistic" point, and caculate the distance to it. For example, > now > > > > > in the new direction you somtimes have to travel on the first route > to > > > > > get to the nearst spot, which I don't want. > > > > > > > Anybody have suggestions? > > > > > Thanks, > > > > > Daniel > > > > > > -- > > > > Bjorn Brala > > > > ---------------- > > > > GeoStart.nl- Google maps - Swis Webdesign > > > > -- > > Bjorn Brala > > ---------------- > > GeoStart.nl- Google maps - Swis Webdesign > > > -- Bjorn Brala ---------------- GeoStart.nl- Google maps - Swis Webdesign --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Maps API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/Google-Maps-API?hl=en -~----------~----~----~----~------~----~------~--~---
