[OpenLayers-Users] Vector Filters
Brad Spencer
brad at cubewerx.com.au
Wed Jul 22 02:47:13 EDT 2009
List,
I have successfully built a layer of points and styled them with a stylemap.
However, I now want to filter these after they have been loaded via an
interactive user process.
To test filtering I assume you have to include a filter in the vector layer
definition and then later you can redefine it and refresh the vector layer
with the new filter active?
To test this, I am trying to make sure that there is a filter on the new
vector layer at load time just to see that my assumptions are correct.
Whilst the code runs it does not filter. I have added an attribute called
'color' to the array used to build the layer and assume it is the property
value needed in the Filter?
I can't see any examples that do exactly this so thought I would seek advice
from the pond.
// show the first color value
alert('Color = '+sortedPoints[0].attributes.color);
// create the vector layer and apply the styleMap at the same time
userMarkers = new OpenLayers.Layer.Vector( "Vector Markers",
{ styleMap: styleMap,
rendererOptions: {zIndexing: true}
,filter: new OpenLayers.Filter.Comparison
({
type: OpenLayers.Filter.Comparison.EQUAL_TO,
property:'color',
value:'#FF0000'
})
});
// pointFeature is the array of sorted point objects to be added as vector
markers
userMarkers.addFeatures(sortedPoints);
map.addLayer(userMarkers);
I must be doing something very wrong here. Can anyone quickly see a problem?
Cheers, Brad.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090722/bdd66359/attachment.html
More information about the Users
mailing list