Skip to content

Instantly share code, notes, and snippets.

@mbklein
Created July 13, 2010 06:20
Show Gist options
  • Save mbklein/473516 to your computer and use it in GitHub Desktop.
Save mbklein/473516 to your computer and use it in GitHub Desktop.
function calcRoute() {
var start = document.getElementById("start").value;
var end = document.getElementById("end").value;
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
var route = directionsDisplay.directions.routes[0]
var request = { 'path' : route.overview_path , 'samples' : Math.min(Math.floor(route.legs[0].distance.value / 500),1024) }
elevationService.getElevationAlongPath(request, function(result, status) {
elevationData = result;
})
}
});
}
Copy link

ghost commented Jul 14, 2014

I've tried to incorporate this into a project that I am using and could use a little help. Do you have a working version of this or could I pass you my source code and have you take a peek?

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment