var points = new Array();
GEvent.addListener(map, "click", function(overlay,latlng) {
points.push(latlng.toUrlValue(6));
if (points.length == 2) {
directions.loadFromWaypoints(points);
}
});
You of course need to have setup a "GMap2" object, and a GDirections object.
On Thu, Sep 8, 2011 at 11:23 PM, ammu <[email protected]> wrote:
> Hi,
>
> Can anyone please let me know a sample code to store the lat/lng
> values in an array and then showing the directions between those
> points?
>
> When user clicks on one point in a map I will store that value and
> then user clicks on another map I will store that as well and then
> display the directions from point 1 to point 2.
>
> Thanks in advance.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Maps API V2" 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.
>
>
--
You received this message because you are subscribed to the Google Groups
"Google Maps API V2" 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.