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?


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? – Shenbaga Rajan Jul 20 '16 at 7:59
  • yes - use AND or OR to combine the cql filters and redraw the layer – Ian Turton Jul 20 '16 at 8:00

Your Answer

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

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