Referencing draggable route waypoints.

297 views
Skip to first unread message

ironcito

unread,
Sep 11, 2010, 4:57:08 PM9/11/10
to Google Maps JavaScript API v3
Hello!

A user drags a route and creates a waypoint. How do I reference that
waypoint? For example, if I want to know its position, or delete it
when the user right-clicks it.

Thanks in advance!

Diego

geoco...@gmail.com

unread,
Sep 11, 2010, 5:33:58 PM9/11/10
to Google Maps JavaScript API v3
On Sep 11, 4:57 pm, ironcito <cor...@ironcito.com> wrote:
> Hello!
>
> A user drags a route and creates a waypoint.
> How do I reference that waypoint?

I don't think the drag operation results in a waypoint (at least that
you can access).

> For example, if I want to know its position, or delete it
> when the user right-clicks it.

I don't know that you can get access to it to delete it.

You can process the results object to find the start and end of each
step; but I don't know that the dragged location will appear in that.

You can do it all manually, but that loses some of the coolness of the
new draggable directions.

You could probably create a feature request for access to the
waypoints used to create the final route.
http://code.google.com/p/gmaps-api-issues/issues/list?can=2&q=apitype:Javascript3

-- Larry

>
> Thanks in advance!
>
> Diego

Esa

unread,
Sep 12, 2010, 7:47:01 PM9/12/10
to Google Maps JavaScript API v3
The waypoints that are added by dragging seem to create a
via_waypoint[] array to the DirectionsLeg object of DirectionsResult.

via_waypoint[] array contains objects that have properties:

location (LatLng)
step_index (number)
step_interpolation (number)

Reply all
Reply to author
Forward
0 new messages