title: Accessing Coordinates in Nested JSON File
body: <p>I'm trying to access lat/lng of polygons within a nested JSON file and trying to draw them using <code>new google.maps.Polygon()</code>, but having some troubles. </p>
  
  <p><strong>UPDATE-2</strong>: I am able to draw polygons, but it only draws the first polygon, not all 3: <a href="http://jsfiddle.net/vprbqaLm/10/" rel="nofollow">http://jsfiddle.net/vprbqaLm/10/</a></p>
  
  <p><strong>UPDATE</strong>: Check out my latest JSFiddle here: <a href="http://jsfiddle.net/vprbqaLm/9/" rel="nofollow">http://jsfiddle.net/vprbqaLm/9/</a>
  Now I can't seem to read the coordinates as I get the following error: <code>Uncaught TypeError: Cannot read property 'coordinates' of undefined</code></p>
  
  <p>Here is what my code looks like:</p>
  
  <pre><code>var coords = data.features.geometry.coordinates;
  var paths = [];
  for (i = 0; i &lt; coords.length; i++) {
      for (j = 0; j &lt; coords[i].length; j++) {
          var path = [];
          for (k = 0; k &lt; coords[i][j].length; k++) {
              var ll = new google.maps.LatLng(coords[i][j][k][1], coords[i][j][k][0]);
              path.push(ll);
          }
          paths.push(path);
      }
  }
  var polygon = new google.maps.Polygon({
      paths: paths,
      strokeColor: "#FF7800",
      strokeOpacity: 1,
      strokeWeight: 5,
      fillColor: "#46461F",
      fillOpacity: 1
  });
  return polygon;
  </code></pre>
  
  <p>Here is the sample JSON file:</p>
  
  <pre><code>    var data = {
      "type": "FeatureCollection",
          "features": [{
          "type": "Feature",
              "id": 1,
              "properties": {
              "Name": "",
                  "description": "",
                  "timestamp": "",
                  "begin": "",
                  "end": "",
                  "altitudeMode": "clampToGround",
                  "tessellate": 1,
                  "extrude": -1,
                  "visibility": -1
          },
              "geometry": {
              "type": "Polygon",
                  "coordinates": [
                  [
                      [-83.126571,
                      42.348706],
                      [-83.126520,
                      42.348634],
                      [-83.126516,
                      42.348635],
                      [-83.126147,
                      42.348778],
                      [-83.126144,
                      42.348780],
                      [-83.126195,
                      42.348852],
                      [-83.126199,
                      42.348851],
                      [-83.126568,
                      42.348708],
                      [-83.126571,
                      42.348706]
                  ]
              ]
          }
      }, {
          "type": "Feature",
              "id": 2,
              "properties": {
              "Name": "",
                  "description": "",
                  "timestamp": "",
                  "begin": "",
                  "end": "",
                  "altitudeMode": "clampToGround",
                  "tessellate": 1,
                  "extrude": -1,
                  "visibility": -1
          },
              "geometry": {
              "type": "Polygon",
                  "coordinates": [
                  [
                      [-83.132805,
                      42.356496],
                      [-83.132753,
                      42.356423],
                      [-83.132751,
                      42.356424],
                      [-83.132243,
                      42.356624],
                      [-83.132241,
                      42.356625],
                      [-83.132294,
                      42.356698],
                      [-83.132296,
                      42.356697],
                      [-83.132802,
                      42.356497],
                      [-83.132805,
                      42.356496]
                  ]
              ]
          }
      }, {
          "type": "Feature",
              "id": 3,
              "properties": {
              "Name": "",
                  "description": "",
                  "timestamp": "",
                  "begin": "",
                  "end": "",
                  "altitudeMode": "clampToGround",
                  "tessellate": 1,
                  "extrude": -1,
                  "visibility": -1
          },
              "geometry": {
              "type": "Polygon",
                  "coordinates": [
                  [
                      [-83.126776,
                      42.351813],
                      [-83.126492,
                      42.351413],
                      [-83.126189,
                      42.351525],
                      [-83.126191,
                      42.351528],
                      [-83.126376,
                      42.351807],
                      [-83.126776,
                      42.351813]
                  ]
              ]
          }
      }]
  };
  </code></pre>