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
map.zoomToExtent(extent)
source
With OpenLayers 4.x, I found the following methods useful:
map.getView().setCenter([x, y]); map.getView().setZoom(z);
where x, y, z are the coordinates where you want to zoom to.
x
y
z