Hi,
I'm creating my own "make your own route" google maps application.
At current the user can double click on the map, and it'll create
markers joined up by polylines.
Each time they double click, I add a marker, and get the polyline from
the last marker to the current one using
"directions.loadFromWaypoints". I store the markers and polylines in
arrays, so can easily "removeOverlay" when a user clicks "undo".
The problem is that I want them to be able to re-load their route, and
still be able to undo steps.
When re-loading a route, at current I use:
directions.loadFromWaypoints(['51.456430000000005,
-0.15499000000000002', '51.45425, -0.15393', '51.45288000000001,
-0.15101'], {getPolyline:true});
This however returns a single polyline for the route (rather than the
multiple polylines it'll be made up of). If the users click undo, it
removes the whole polyline.
If undo is clicked, I want to remove the last marker, and the polyline
between it, and the previous marker. I can't do this with a single
polyline as shown above.
I was thinking of creating multiple instances of GDirections, one for
each polyline to be exact. But this can't be very efficient.
Especially if a user adds more than 20 markers.
I was just wondering if there's an easier way to do this, or if I'm
missing something obvious. I've googled around, but can't find much on
the matter.
Thanks,
Rob
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---