Save a copy of the user's address and coordinates into a global variable
from your searchLocations() function.

var userLocation;

...
  } else {
    userLocation = address +"@"+ latlng.toUrlValue(5);
    searchLocationsNear(latlng);


Save a copy of the nearest Pizza name and coordinates into a global
variable from your searchLocationsNear() function.

var pizzaLocation;

...
    var marker = createMarker(point, name, address);
    map.addOverlay(marker);
    if (i == 0) {
      pizzaLocation = name +"@"+ point.toUrlValue(5);



Then use GDirections

var gdir = new GDirections(map);  // global

<input type="button" onclick="getDirections()" value="Get Directions"/>

function getDirections() {
  gdir.loadFromWaypoints([userLocation,pizzaLocation]);
}


-- 
http://econym.org.uk/gmap
The Blackpool Community Church Javascript Team


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to