I'm working on a project, written in AS3. I'm using the Google Maps API to load different maps, add custom markers, ... All that works, but I'd like to create something different. Imagine it being an application to create an itinerary.
There are 10 markers on my map, and the user could click all of them to create an itinerary between those markers. I've tried with Polyline, but that only creates lines from one point to the other without following the actual roads.
Then I've found out about the existence of "Directions" and "Route" i开发者_JAVA百科n the Google Maps API, but I can't wrap my head around that. Or I'm doing something really wrong. Also, that is for one point to the other - mine needs to have multiple waypoints.
I've found dozens of examples on how to do it with JavaScript, but the project HAS to be made in AS3. (Yeah, ... I know)
If there's anyone who could give me a push in the right direction, I'd really appreciate it!
Have you successfully been able to draw directions between two points? Is it just the multiple points that are causing issues?
Have you read through and attempted some of the code in this section of the guide? http://code.google.com/apis/maps/documentation/flash/services.html#Driving_Directions
I've only used the JS API, so might be incorrect, but couldn't you either...
- Call the directions API function multiple times: A to B, B to C, C to D, etc.
Or call the directions API using a string such as
place1 to: place2 to: place3 to: place4
(For each place I think you can use either a street address or GPS position)
Hope that helps.
Simon.
精彩评论