I have multiple checkboxes for example hospital checkbox where hospital datasets get displayed when checked, phase 1 check box where phase 1 hospitals get displayed when checked and grade A and B check boxes where when A is checked grade A hospital gets displayed. This is a kind of static filter.But I need dynamic filtering. For example, when phase 1 is checked and then grade A is checked I need phase 1 hospitals having grade A to get displayed. Likewise for other flters. Can anyone give suggestion on it using CQL_FILTERING and OpenLayers?

1 Answer 1


You can simply create a CQL filter that combines the elements that you need to select, so:

CQL_FILTER=phase=1 AND grade='A' 

OpenLayers should take care of URL encoding it for you.

  • Thank you. Actually, I have a function in which I access check boxes using ID and each for each check box I have a CQL FILTER. Now I need to combine the CQL filters according to the check boxes checked dynamically. Is that possible? Commented Jul 20, 2016 at 7:59
  • yes - use AND or OR to combine the cql filters and redraw the layer
    – Ian Turton
    Commented Jul 20, 2016 at 8:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.