[OpenLayers-Users] Filtering a GeoJSON layer

Aparna aparna.mookerjee at gmail.com
Tue Jan 3 05:51:43 EST 2012


This does not seem to be working either.

var state = new OpenLayers.Layer.Vector("K", {
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.WFS({
                    version: "1.1.0",
                    url: "http://localhost:8085/geoserver/wfs",
                    params: {CQL_FILTER: 'SCHCAT = 3'},
                    featureType: "karf",
                    featureNS: "http://opengeo.org/India"

                })
            });
            map.addLayer(state);



On Wed, Dec 28, 2011 at 12:07 AM, Arnd Wippermann <arnd.wippermann at web.de>wrote:

> **
> 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/20120103/967dd9c3/attachment.html


More information about the Users mailing list