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

aparna aparna.mookerjee at gmail.com
Fri Dec 23 01:21:22 EST 2011


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/how-to-implement-a-filter-in-a-geoJSON-layer-tp7120865p7120865.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/20111222/f792dbc5/attachment.html


More information about the Users mailing list