OpenLayers 2 had a very useful map.zoomToExtent(extent)
feature. Is there something similar in OpenLayers 3? I can get the extent of interest with source.getExtent()
, but I can't figure out how to apply that extent as a "zoom level".
Going off the function sfletche linked to:
var extent = source.getExtent();
map.getView().fitExtent(extent, map.getSize());
EDIT July 23, 2013
Apparently fitExtent
is deprecated. Should be ol.View.fit
, so something linke this (untestesd):
var extent = source.getExtent();
map.getView().fit(extent, map.getSize());