title: Get lat and lon for each point in polygon - Google Maps API v3
body: <p>I found an answer for how to get the latitude and longitude for each point of the polygon here:</p>
  
  <p><a href="https://stackoverflow.com/questions/5072059/polygon-drawing-and-getting-coordinates-with-google-map-api-v3/22696201#22696201">Polygon Drawing and Getting Coordinates with Google Map API v3</a></p>
  
  <p>This appeared to work when I implemented it, however is no longer working, and I get the error:</p>
  
  <p>"Error: TypeError: polygon.overlay.latLngs.b is undefined"</p>
  
  <p>This is my code:</p>
  
  <pre><code>function polygonPoints(polygon) {
      var polygonPointsArray = [];
  
      $.each(polygon.overlay.latLngs.b[0].b, function(key, latlng){
              var lat = latlng.d;
              var lon = latlng.e;
  
              polygonPointsArray.push(lat+' '+lon); //do something with the coordinates
      });
  }
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thanks</p>
  
  <p>Matt</p>