Hi,

You have to wrap your filters with a logical filter 'OR'.

var filter=new OpenLayers.Filter.Logical({
        type: type,
        filters:filters
});

Arnd

 

-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Planet)x
Gesendet: Montag, 6. Dezember 2010 20:42
An: [email protected]
Betreff: [OpenLayers-Users] OpenLayers.Filter,multiple values so I can show
all?


I am trying to do a filter using the OpenLayers.Filter. Well it is working
perfectly basically it is sent an Address_Key field and then the filter is
performed on this against my WFS and then the layer with a red border around
it related to this parcel is added to my map and the map is zoomed in. My
problem is I need to actually query multiple "address keys" and have each
one be selected with the same red box but then set the zoom to be able to
display all of these the same way it zooms into one of them. Is this
possible? Here is my code so far but unsure how to change it to accomplish
this.. say instead of sending the value (which would be one address key) i
am trying to send an array of values and then loop through them adding each
one and then zooming to the right zoom but it doesn't appear to be working..
appreciate any help!

(value is an array sent to this which contains multiple address keys
matching the Orig_AddrKey property)

    var filter;
    var name = 'Address Query';
    var property = 'Orig_AddrKey';
    
    var count = (value.length -1);
    
    //loop through each address item
    while (count >= 0)
    {
        // check if OGC attribute filter is used
        if (property && value) 
        {
                // filter based on property=value
                filter = new OpenLayers.Filter.Comparison({
                type: OpenLayers.Filter.Comparison.EQUAL_TO,
                property: property,
                value: value[count]
                });
        }
        
     // create an OpenLayers.Layer.Vector layer where WFS 1.1.0 is used to
query feature.
    // GML is then used to fill layer
    var grid = new OpenLayers.Layer.Vector(name, {
    
        displayInLayerSwitcher: false,

        // init style
        styleMap: new OpenLayers.StyleMap(style),

        // init strategy : fixed=WFS query once, Cluster=Point feature group
within a tolerance
        // speeding up drawing process
        strategies: [new OpenLayers.Strategy.Fixed()],

        protocol: new OpenLayers.Protocol.WFS({
            url: wfs,
            featureType: "WEB_Parcels",
            featureNS: "http://www.intergraph.com/geomedia/gml";,
            featurePrefix: "gmgml",
            srsName: "EPSG:3776",
            filter: filter,
            geometryName: "Geometry",
            version: "1.1.0"
        })
    });
   
    map.addLayer(grid);

    //recenter on selection
    grid.events.register("loadend", grid, function() {
        map.zoomToExtent(grid.getDataExtent());
    });
    
    count -=1;
    } //end while loop
--
View this message in context:
http://osgeo-org.1803224.n2.nabble.com/OpenLayers-Filter-multiple-values-so-
I-can-show-all-tp5809151p5809151.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

_______________________________________________
Users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to