I have a WMS layer and want use zoomToExtent after CQL filter. So I get the layer BBOX from the GeoServer WMS using a GetCapabilities request.
wms = new OpenLayers.Format.WMSCapabilities();
OpenLayers.Request.GET({
url:"http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities",
success: function(e){
var response = wms.read(e.responseText);
var capability = response.capability;
for (var i=0, len=capability.layers.length; i<len; i+=1) {
var layerObj = capability.layers[i];
if (layerObj.name === 'filedata') {
map.zoomToExtent(OpenLayers.Bounds.fromArray(layerObj.llbbox));
break;
}
}
}
});
But zoomToExtent doesn't work with lon lat, so how to get the BBOX in meters?
My map showed in epsg900913.
Best Answer
you should use transform method for getting your result in meters.
Parameters
Example :
i hope it helps you...