Geoserver CQL Filter usage, INCLUDE

GeoServer’s WMS implementation allows an additional parameter in the url called CQL_FILTER. This parameter allows you to use a little language called Common Query Language, or CQL, to apply data filters to the tiles that GeoServer generates. CQL is a plain text, human readable query language created by the OGC, but I like to think of it as an extremely limited third-cousin-by-adoption of SQL.

You can use the following operators in a CQL phrase:

  • Comparison operations: =, <, >, and combinations
  • Math expressions: +, -, *, /
  • NOT
  • IS, EXISTS
  • BETWEEN, BEFORE, AFTER
  • IN
  • LIKE
  • Geometric operators: CONTAINS, BBOX, DWITHIN, CROSS(ES), INTERSECT(S)
If you also have two or more layers definition in one like this http://localhost:8080/geoserver/wms?layers=layer1,layer2,layer etc..
so if you want to filter data from specified layer in that group you must order cql_filters like this


http://localhost:8080/geoserver/wms?layers=layer1,layer2,layer3&cql_filter=INCLUDE;(ATR_LAYER2='some value');INCLUDE... etc

this means that layer1 and layer3 will not be filtered, the seperator between filters is ";"

This works on newest versions of geoserver :]

Comments

  1. Thanx! That was exactly what I was looking for!
    You helped me fix my problem.

    Now I can filter grouped layers...

    ReplyDelete

Post a Comment

Popular Posts