With GMaps.js you can calculate the elevation for a route like this:
map.getElevations({ locations : [[-12.040397656836609,-77.03373871559225], [-12.040248585302038,-77.03993927003302], [-12.050047116528843,-77.02448169303511], [-12.044804866577001,-77.02154422636042]], path: true, callback : function (result, status){ if (status == google.maps.ElevationStatus.OK) { console.log(result, status); } } });