I created a map with OpenLayers OSM. On this map I add an image provided by GeoServer. My question is how to focus the image when it is added to the map. As zooming into the area on the map where the image is added.
var result = new ol.layer.Image({
source: new ol.source.ImageWMS({
url: 'http://localhost:8080/geoserver/pgrouting/wms',
params: params
})
});
map.addLayer(result);
map.zoomToMaxExtent();