I have a map with WMS layer. And want to zoom to selected object. Now i use GetCapabilities
from Geoserver and zoom to bbox of whole layer.
So how to do what i want?
Or can u tell me how to get feature bbox from Capabilities? Or how to get FeatureInfo without clicking on map?
UPDATE
info_id=myVecLayer.getFeaturesByAttribute("id",'5')
alert(info_id[0].geometry.getBounds());
app.mapPanel.map.zoomToExtent(info_id[0].geometry.getBounds());
//myVecLayer is WFS layer
Its do something strange. If feature shows in map window it will be zoomd to it. But if not shows get a error TypeError: info_id[0] is undefined
. What is wrong?
UPDATE 2
Ok now this is Request method
info_id=OpenLayers.Request.GET({
url:'http://localhost:8080/geoserver/wfs?service=wfs&version=1.1.0&request=GetFeature&typeName=cite:filedata_temp&featureID=filedata_temp.4',
success: function(e){
alert(e.responseText);
}
});
its ok. But how to get bbox from there?
UPDATE 3
Now i use a GeoExt.FeatureStore to zoom to feature.
But i have a problem i try zoom_store.layer.getFeaturesByAttribute("id",'5');
and all work. But if i use variable zoom_store.layer.getFeaturesByAttribute("id",some_variable);
i get error TypeError: info_id[0] is undefined
. Why its heppening?
getFeaturesByAttribute
togetFeatureByFid
and all works fine. I dont know whats wrong withgetFeaturesByAttribute
maybe this Returns an array of features that have the given attribute key set to the given value. Comparison of attribute values takes care of datatypes, e.g. the string ‘1234’ is not equal to the number 1234.