Michal, You can try making Ajax call for WFS using a general ajax function or make use of OpenLayers.loadURL or similar ones.
I work mainly with Geoserver and in order to get bounds, you will have to turn on the "return bounding box for every feature" in the WFS settings. A sample WFS for Geoserver http://MyServer/geoserver/wfs?request=GetFeature&version=1.1.0&typeName=topp:states&propertyName=STATE_NAME,PERSONS&MAXFEATURES=1 A sample working WFS for MapServer http://demo.mapserver.org/cgi-bin/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=getfeature&TYPENAME=continents&MAXFEATURES=1 Parse the output from the XML of Ajax call. Look for <gml:boundedBy> tag if you are just zooming to the bounds. You will have to look at <Geometry> or <geom> tag and build you own feature out of the coordinates and overlay it. May be someone has a better way of doing this. -Ravi. ________________________________ From: Michał Średnicki <[email protected]> To: Ravi Pavuluri <[email protected]> Cc: [email protected] Sent: Fri, March 11, 2011 9:58:25 AM Subject: Re: [OpenLayers-Users] Zoom to filtered feature Thank you Ravi. The parcel layer is served also via WFS but I don't have much experience with dealing with WFS layers in OpenLayers. Can you say something more about this method of receiving feature bounds in Open Layers? Regards, Michal 2011/3/11 Ravi Pavuluri <[email protected]> Michal, > >I am not sure if this answers your question completely. You can try using WFS >which can get the boundary of your feature of interest and then you can code >for >zooming to those bounds. > >-Ravi. > > > > ________________________________ From: michsred <[email protected]> >To: [email protected] >Sent: Fri, March 11, 2011 3:58:47 AM >Subject: [OpenLayers-Users] Zoom to filtered feature > > >Hi list, > >is there possible to perform automatical zoom to feature filtered by CQL >filter? > >I have a WMS layer containig parcels and I want to enable some kind of >searching mechanism where user will put parcel number to a form and after >apply it the only searched parcel will be displayed and map view will be set >to this parcel's bounds. > >I enabled CQL filtering like this: > > function updateFilter(){ > if(pureCoverage) > return; > > var filter = "parcel_number = " + >document.getElementById('filter').value; > > var filterParams = { > cql_filter: filter > }; > > mergeNewParams(filterParams); > } > > function mergeNewParams(params){ > myLayer.mergeNewParams(params); > } > >and after I put parcel number to a form connected with updateFilter() >function and apply it, the only searched parcel is dispayed. My question is >what should I do to enable zooming to the filtered parcel? Is it possible to >retrieve BBOX of a particular feature from WMS layer and then use it in JS? > >Thank you in advance for any suggestions! > >Michal > >-- >View this message in context: >http://osgeo-org.1803224.n2.nabble.com/Zoom-to-filtered-feature-tp6160737p6160737.html > >Sent from the OpenLayers Users mailing list archive at Nabble.com. >_______________________________________________ >Users mailing list >[email protected] >http://lists.osgeo.org/mailman/listinfo/openlayers-users > > -- Michał Średnicki
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
