AW: [OpenLayers-Users] Filtering a GeoJSON layer

Arnd Wippermann arnd.wippermann at web.de
Tue Dec 27 13:37:40 EST 2011


Hi,
 
i think, you cannot use filter to load static data. OpenLayers have to load
the whole file and doesnot use the filter to serialize only parts of the
file and add them as features.
 
If you request the data from a provider, which evaluates the filter like
WFS, filter does work.
 
Instead you can use a styleMap to display only a set of features.
 
Arnd
 
  _____  

Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von Aparna
Gesendet: Montag, 26. Dezember 2011 12:15
An: users at openlayers.org
Betreff: [OpenLayers-Users] Filtering a GeoJSON layer


filtering either after projection or in the protocol->format->filter does
not seem to be working at all. 

var state = new OpenLayers.Layer.Vector("State", {
                projection: map.displayProjection, 
                filter: new OpenLayers.Filter.Comparison({
                type: OpenLayers.Filter.Comparison.EQUAL_TO,
                property: 'SCHMGT',
                value: 2
            }),                              
        strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "klm/GIS.json",

                    format: new OpenLayers.Format.GeoJSON({

                        extractAttributes: true                      
           
                    })
                })
            });

How does one implement a filter?? 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111227/92e5f085/attachment.html


More information about the Users mailing list