I have a cluster strategy being used on a vector layer that is working correctly. However, when I try and add the filter strategy to the vector layer, the filtered data does not appear on the map, in fact when I add the filter strategy, neither the cluster strategy or filter strategy appear on the map. I only see the base layer. I've seen the example in the OpenLayers 2.12 documentation; I have even hardcoded the property 'Value' to see if it would work but it doesnt work. Here is my code:

var year_filter = new OpenLayers.Filter.Comparison({
     Type: OpenLayers.Filter.Comparison.BETWEEN,
     Property: “start_date”,
     Value: '2012/04/22',
     lowerBoundary: new Date(2012, 01,01),
     upperBoundary: new Date(2013, 11, 30)

var cluster_strategies = [new OpenLayers.Strategy.Cluster({distance: 42})];
var filter_strategies = [new OpenLayers.Strategy.Filter({filter: year_filter})];
var layer_name = “Active Assignments”;

mapVars.activeAssignmentLayer = new OpenLayers.Layer.JsonLayer(layer_name, {
    location: “/assignments/index.json?mode=active”,
    attributeMap: [“name”, “start_date”, “end_date”, “city”]
    strategies: [cluster_strategies, filter_strategies],
    styleMap:  mapVars.clusterStyleMap

  • Welcome to GIS.SE. When you say "cannot get it to work", can you say what happens instead? Please remember we can't see your screen, so while its obvious to you, you need to describe it in detail to us. – BradHards Dec 31 '14 at 3:41
  • I mean that my layer is not showing the 'filter_strategies' or the 'cluster_strategies' that I created ('cluster_strategies' appears on the map fine as the only strategy). When I try and add the filter_strategies to the 'strategies' property, my map shows neither of the strategies. I am trying to display on my map employees that have been hired between the two dates indicated in the upper and lower boundary. – user1288560 Dec 31 '14 at 17:47
  • Please edit the question with these important details, rather than leaving it in the comments where it is likely to be missed. – BradHards Dec 31 '14 at 21:35
  • The question has been edited. – user1288560 Jan 23 '15 at 2:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.