Skip to content

Instantly share code, notes, and snippets.

@everdaniel
Created April 23, 2014 03:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save everdaniel/11201824 to your computer and use it in GitHub Desktop.
Save everdaniel/11201824 to your computer and use it in GitHub Desktop.
Driving Directions / GMap3
var destinations = new Array();
destinations.push('Wattle Glen, Diamond Creek, Victoria 3089');
destinations.push('Watsonia, Diamond Creek, Victoria 3089');
destinations.push('St Helena, Diamond Creek, Victoria 3089');
destinations.push('Plenty, Diamond Creek, Victoria 3089');
destinations.push('Montmorency, Diamond Creek, Victoria 3089');
destinations.push('Hurstbridge, Diamond Creek, Victoria 3089');
destinations.push('Bundoora, Diamond Creek, Victoria 3089');
destinations.push('Doreen, Diamond Creek, Victoria 3089');
destinations.push('Eltham, Diamond Creek, Victoria 3089');
destinations.push('Greensborough, Diamond Creek, Victoria 3089');
$.each(destinations, function(index, neighborhood) {
$("#test").gmap3({
getroute:{
options:{
origin: neighborhood,
destination: '10/331 Diamond Creek Road Diamond Creek VIC 3089',
travelMode: google.maps.DirectionsTravelMode.DRIVING
},
callback: function(results){
if (!results) return;
$(this).gmap3({
map:{
options:{
zoom: 13,
center: [-37.677511, 145.127850]
}
},
directionsrenderer:{
container: $(document.createElement("div")).addClass("googlemap").insertAfter($("#test")),
options:{
directions:results
}
}
});
}
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment