title: Leaflet: retrieving bounds for a KML polygon
body: <p>I'm inserting polygons into a Leaflet map using a Leaflet plugin called <a href="https://github.com/mapbox/leaflet-omnivore" rel="nofollow">leaflet-omnivore</a>. The syntax I'm using is:</p>
  
  <pre><code>var polygon = omnivore.kml('placeName.kml');
  polygon.addTo(map);
  </code></pre>
  
  <p>This works great; the polygon appears on my map. However, once it's added I want to then zoom/pan the map to fit the shape as best as possible. I've been trying this:</p>
  
  <pre><code>polygon.addTo(map).fitBounds();
  </code></pre>
  
  <p>...but that throws an error: <code>'fitBounds is not a function'</code>. I've also tried to find the coordinates using this:</p>
  
  <pre><code>polygon.addTo(map).getBounds().getNorthEast();
  </code></pre>
  
  <p>...but that comes back with <code>'cannot read property 'lat' of undefined'</code>.</p>
  
  <p>Anyone have any ideas? I'm stumped. Documentation is <a href="http://leafletjs.com/reference-1.0.0.html" rel="nofollow">here</a> and I'm using Leaflet 1.0.0.</p>