CloudMade/Leaflet — Issue #360: Any easy method to change center and zoom to fit a polygon layer
Author: palewire
Created: 2011-11-04 19:02:21+00:00
State: open

In OpenLayers, you can do something slick like this:

var poly = wkt.read(' ... ');
vectorLayer.addFeatures([poly]);
map.addLayer(vectorLayer);
var bounds = poly.geometry.getBounds();
map.zoomToExtent(bounds);

Is there a way to make that happen in Leaflet?