title: distance of a polyline
body: <p>I am working in a polyline and I need to obtain the distance of this. So if anyone can help I would be very gratefully.</p>
  
  <p>Best regards.</p>
  
  <p>This is my code:</p>
  
  <pre><code>function polyline() {
  downloadUrl("xmlPolyline.asp", function(data) {
      var xml = xmlParse(data);
      var markersPath = xml.documentElement.getElementsByTagName("marker");   
      var path = [];
  
  
      for (var i = 0; i &lt; markersPath.length; i++) {
      var lat = parseFloat(markersPath[i].getAttribute("lat"));
      var lng = parseFloat(markersPath[i].getAttribute("lng"));
      pointPath = new google.maps.LatLng(lat,lng);
  
  
      path.push(pointPath);
  
  }//finish loop
  
   polyline = new google.maps.Polyline({
    path: path,
    strokeColor: "#FF0000",
    strokeOpacity: 1.0,
    strokeWeight: 2
  });
  
  
  //new polyline
  
  polyline.setMap(map);
  
  }); //end download url
  
  }
  </code></pre>