How to focus the image when it is added to the map in OpenLayers?

المشرف العام

Administrator
طاقم الإدارة
I created a map with openlayer 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();

thanks



أكثر...
 
أعلى