Wasn't it alan tarn who wrote: > >ohh .thanks for this important information . however . do u have any >idea on how to go about doing this "suggested route" thing? Thanks .
Your only legal strategies are: 1) Throw the request at maps.google.com, and let it do the suggestions, i.e. open a new browser window and pass it something like http://www.google.com/maps?f=d&source=s_d&saddr=Jurong+West,+Singapore&da ddr=Ang+Mo+Kio,+Singapore&hl=en 2) Just display the normal route and the avoid highways route. 3) Try to guess sensible waypoints to add in the middle of he route that might lead to reasonable alternatives. That's not easy unless you have a database of highways or highway intersections, and can look for such an intersection that's somewhere between your start and end points (for some approximate value of "between"). There may be problems using lat/lng coordinates for the waypoints, particularly if there's a dual carriageway involved. If the coordinates are for a point on the wrong carriageway, GDirections will drive a considerable distance out of your way so that you visit the wrong side of the road. But even using street names you may well get strange kinks near the waypoints, like this: from: Jurong West, Singapore to: Ayer Rajah Expy singapore to: Ang Mo Kio, Singapore Perhaps the only way to really deal with that is to include points on both sides of a dual carriageway, and well clear of roads that cross underneath or overhead, and then try to filter out the ones that are silly. Consider these examples from: Jurong West, Singapore to: 1.32558,103.740764 to: Ang Mo Kio, Singapore from: Jurong West, Singapore to: 1.32582,103.740764 to: Ang Mo Kio, Singapore One of those adds 7 minutes to the trip by a complicated excursion to visit the wrong side of the road. Writing code to filter out silly routes isn't easy. As a first approximation, you could discard routes that have estimated times that are more than, say, 10% longer than the initial route. And you can also compare the durations for pairs of points on opposite sides of a dual carriageway and always discard the slower one. Writing code to discard duplicate routes isn't easy either. For example, a point on Bukit Timah Expy or Kranji Expy might create a route that's a duplicate of Google's Seletar Expy suggestion. -- Mike Williams http://econym.org.uk/gmap --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
