[OpenLayers-Users] Re: how to implement a filter in a geoJSON layer

aparna aparna.mookerjee at gmail.com
Mon Dec 26 01:40:44 EST 2011


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

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({
                        //extractStyles:
true,
                        extractAttributes: true

                    })
                })
            });

How does one implement a filter??

On Fri, Dec 23, 2011 at 11:51 AM, Aparna <aparna.mookerjee at gmail.com> wrote:

> I have a GeoJson overlay layer, which has styles implemented via Rule
> (Filter and Symbolizer) and its working. Now I want to implement filtering
> on the GeoJson layer based on user input. How does one implement this
>
> var state = new OpenLayers.Layer.Vector("State", {
>                 projection: map.displayProjection,
>         strategies: [filterStrategy,
>         new OpenLayers.Strategy.Fixed()],
>                 protocol: new OpenLayers.Protocol.HTTP({
>                     url:
> "klm/GIS.json",
>                     format: new OpenLayers.Format.GeoJSON({
>                         //extractStyles: true,
>                         extractAttributes: true
>                     })
>                 })
>             });
>             map.addLayer(state);
>
> var filter = new OpenLayers.Filter.Comparison({
>     type: OpenLayers.Filter.Comparison.EQUAL_TO,
>     property: "",
>     value: ""  });
>
> var filterStrategy = new OpenLayers.Strategy.Filter({});
>
> How does one dynamically change the property and value given user input
> from a textbox?
>


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Re-how-to-implement-a-filter-in-a-geoJSON-layer-tp7127323p7127323.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20111225/52d7be63/attachment.html


More information about the Users mailing list