title: Create Elevation profile from polyline coordinate array
body: <p>I have created a polyline using a coordinate array with code adapted from 
  <a href="https://google-developers.appspot.com/maps/documentation/javascript/examples/polyline-simple" rel="nofollow">https://google-developers.appspot.com/maps/documentation/javascript/examples/polyline-simple</a></p>
  
  <p>Although the first (and probably worst) method to make the line was just a huge list of lat/lng points. Still learning the programming tricks, I apologize.  Im a geographer not a programmer!</p>
  
  <p>I want to get the elevation from that line and create an elevation profile graph.
  Im new to JS and not sure how to debug whats not working.  I cant seem to populate the path array with the coordinates from the polyline.</p>
  
  <p>Its currently set to push the bikeCourseCoordinates to a new array that will then be used as a path.  I tried it just using the bikeCourseCoordinates array as the 'path' but that didnt work either.</p>
  
  <p>Online (but not working version) here:
  <a href="http://geography.uoregon.edu:50000/bentesting/map_try3.html" rel="nofollow">http://geography.uoregon.edu:50000/bentesting/map_try3.html</a></p>
  
  <hr>
  
  <pre><code>function drawPath() {
  
    // Create a new chart in the elevation_chart DIV.
    chart = new google.visualization.ColumnChart(document.getElementById('elevation_chart'));
  
    var path = new Array;
    path.push(bikeCourseCoordinates);
  
  
    // Create a PathElevationRequest object using this array.
    var pathRequest = {
      'path': path,
      'samples': 256
    }
  
    // Initiate the path request.
    elevator.getElevationAlongPath(pathRequest, plotElevation);
  }
  
  // Takes an array of ElevationResult objects, draws the path on the map
  // and plots the elevation profile on a Visualization API ColumnChart.
  function plotElevation(results, status) {
    if (status == google.maps.ElevationStatus.OK) {
      elevations = results;
  
      // Extract the elevation samples from the returned results
      // and store them in an array of LatLngs.
      var elevationPath = [];
      for (var i = 0; i &lt; results.length; i++) {
        elevationPath.push(elevations[i].location);
      }
  
      // Extract the data from which to populate the chart.
      // Because the samples are equidistant, the 'Sample'
      // column here does double duty as distance along the
      // X axis.
      var data = new google.visualization.DataTable();
      data.addColumn('string', 'Sample');
      data.addColumn('number', 'Elevation');
      for (var i = 0; i &lt; results.length; i++) {
        data.addRow(['', elevations[i].elevation]);
      }
  
      // Draw the chart using the data within its DIV.
      document.getElementById('elevation_chart').style.display = 'block';
      chart.draw(data, {
        width: 640,
        height: 200,
        legend: 'none',
        titleY: 'Elevation (m)'
      });
    }
  }
  </code></pre>