[OpenLayers-Users] zoomToExtent with WFS filter

emrecio emreciolopez at gmail.com
Tue Oct 8 05:17:32 PDT 2013


Hi, I'm trying to make a "searching and zooming" function using filters (from
a textField) and zoomToExtent in a WFS vector layer.

It works, it shows only the features that match with the filter, but the
problem is that zoomToExtent make a zoom to the previous filters applied,
not the current. 

Here is my code:

var textField = new Ext.form.TextField({
            value: "",
            listeners: {
              specialkey: function(fld, e) {
                 
                if (e.getKey() == e.ENTER) {
                        
                      myWFSlayer.filter = new OpenLayers.Filter.Logical({
                                  type: OpenLayers.Filter.Logical.OR,
                                  filters: [
                                      new OpenLayers.Filter.Comparison({
                                          type:
OpenLayers.Filter.Comparison.EQUAL_TO,
                                          property: "CODE1",
                                          value: ""+fld.getValue(),
                                      }),
                                      new OpenLayers.Filter.Comparison({
                                          type:
OpenLayers.Filter.Comparison.EQUAL_TO,
                                          property: "CODE2",
                                          value: ""+fld.getValue(),
                                        
                                      })
                                  ]
                              }); 
                         
                      mapPanel.map.addLayer(myWFSlayer);
                      myWFSlayer.refresh();     
                     
                      mapPanel.map.zoomToExtent(myWFSlayer.getDataExtent());  
        
                              
                }            
            }           
         }
     });


Any idea?



--
View this message in context: http://osgeo-org.1560.x6.nabble.com/zoomToExtent-with-WFS-filter-tp5082375.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.


More information about the Users mailing list