Dear Mike Williams, First of all, thank you for your helps but it did not work. I tried your codes but nothing happened. I added another sidebar to right hand side of the map. Firstly user types his address and system will show addresses and then if user clicks the Get Directions button I want user to get directions from typed address to the closest pizza. If you or someone can help me about it I will be grateful. Thank you,
On Mon, Mar 2, 2009 at 2:06 AM, Mike Williams <[email protected]>wrote: > > 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 -~----------~----~----~----~------~----~------~--~---
