title: Create elevation profile from GeoJson feature
body: <p>I have a map which contains a GeoJson file with lines, displaying some trails. Is it possible to use Google Maps API Elevation Service to create elevation profiles for every feature line of the GeoJson file? I want the elevation profile to be displayed when I click one of the lines.</p>
  
  <p>Something like this example: <a href="http://www.trailforks.com/region/la-bouilladisse/" rel="nofollow">http://www.trailforks.com/region/la-bouilladisse/</a> </p>
  
  <p>My code, until now, looks like this:</p>
  
  <pre><code>google.load("visualization", "1", {packages: ["columnchart"]});
  
  function initialize() {
  var options = {
      center: new google.maps.LatLng(44.701991, 22.624884),
      zoom: 12,
      mapTypeId: google.maps.MapTypeId.TERRAIN
  };
  
  map = new google.maps.Map(document.getElementById("map"), options);
  
  trasee = new google.maps.Data()
  trasee.loadGeoJson('http://googledrive.com/host/0B55_4P6vMjhITEU4Ym9iVG8yZUU/trasee.geojson')
  trasee.setMap(map)
  
  styling = (function(feature) {
      var clasificare = feature.getProperty('Tip_drum');
      var culoare;
      if (clasificare == ('Poteca'))
          (culoare = 'brown')
      else if (clasificare == ('Drum forestier'))
          (culoare = 'green')
      else if (clasificare == ('Drum comunal (neasfaltat)'))
          (culoare = 'brown')
      else if (clasificare == ('Drum judetean (neasfaltat)'))
          (culoare = 'brown')
      else if (clasificare == ('Drum comunal (asfaltat)'))
          (culoare = 'gray')
      else if (clasificare == ('Drum judetean (asfaltat)'))
          (culoare = 'gray')
      else
          (culoare = 'black')
      return ({
          strokeColor: culoare,
          strokeWeight: 3
      })
  })
  
  trasee.setStyle(styling)
  
  elevator = new google.maps.ElevationService();
  }
  </code></pre>
  
  <p>I know that I have to make a request like this:
   var pathRequest = {
      'path': source of latlng for creating the path
      'samples': 256
    }</p>
  
  <p>So basically, I think that the GeoJson must be added somewhere in the pathRequest, but I don't know how, and how to create a different elevation plot for every feature in my GeoJson file.</p>
  
  <p><a href="http://jsfiddle.net/j54gLjap/" rel="nofollow">fiddle of existing code</a></p>
  
  <p>OK, so now I try to display the elevation charts along with the Tip_drum attribute in infowindows, when I click the data. I added this code:</p>
  
  <pre><code>  map.data.addListener('click', function (event) {
      document.getElementById('info').innerHTML = event.feature.getProperty('Tip_drum')
      var content = document.createElement('div')
      var elevations = document.getElementById('elevation_chart')
      var types = document.getElementById('info')
      content.appendChild(elevations)
      content.appendChild(types)
      infowindow.setContent(content)
      infowindow.setPosition(event.latLng)
      infowindow.setMap(map)
      if (event.feature.getGeometry().getType() === 'LineString') {
          drawPath(event.feature.getGeometry().getArray());
  </code></pre>
  
  <p>Everything works fine, until I manually close one of the infowindows. After that, the infowindows won't appear anymore.</p>