You know you can use CQL
to create GeoTools Filter
used when filtering FeatureCollection
. GeoTools 16 user guide has made a quick tutorial and examples for CQL
strings like the following ones:
ATTR1 >= 5
NCLUDE
EXCLUDE
ATTR1 < (1 + ((2 / 3) * 4))
(ATTR1 + ATTR2) > 0.07
ATTR1 < abs(ATTR2)
ATTR1 < 10 AND ATTR2 < 2 OR ATTR3 > 10
ATTR1 LIKE 'abc%'
ATTR1 NOT LIKE 'abc%'
ATTR1 BETWEEN 10 AND 20
ATTR1 IS NULL
ATTR1 IS NOT NULL
ATTR1 DOES-NOT-EXIST // check if something does not exist
string functions:
strToLowerCase(ATTR1) like '%m%'
collections:
ATTR1 IN ('New York', 'California', 'Montana', 'Texas')
IN ('states.1', 'states.12') // with specific feature ids
date time:
ATTR1 TEQUALS 2006-11-30T01:30:00Z // equal to a date
ATTR1 BEFORE 2006-11-30T01:30:00Z // before a date
ATTR1 BEFORE 2006-11-30T01:30:00Z/2006-12-31T01:30:00Z // before a period
ATTR1 AFTER 2006-11-30T01:30:00Z // after a date
ATTR1 AFTER 2006-11-30T01:30:00+03:00 // after a date using time zone GMT+3
ATTR1 AFTER 2006-11-30T01:30:00Z/2006-12-31T01:30:00Z // after a period
geometry:
CONTAINS(ATTR1, POINT(1 2))
BBOX(ATTR1, 10,20,30,40)
DWITHIN(ATTR1, POINT(1 2), 10, kilometers)
CROSS(ATTR1, LINESTRING(1 2, 10 15))
INTERSECT(ATTR1, GEOMETRYCOLLECTION (POINT (10 10),POINT (30 30),LINESTRING (15 15, 20 20)) )
CROSSES(ATTR1, LINESTRING(1 2, 10 15))
INTERSECTS(ATTR1, GEOMETRYCOLLECTION (POINT (10 10),POINT (30 30),LINESTRING (15 15, 20 20)) )
full list of geometric predicates (from geoserver guide ):
EQUALS, DISJOINT, INTERSECTS, TOUCHES, CROSSES, WITHIN, CONTAINS,
OVERLAPS, RELATE, DWITHIN, BEYOND
examples are usefull but I couldn't find any full tutorial about syntax, structure, functions, math functions, etc. Can anyone introduce a full guide for CQL.
udig tutorial:
[or full guide]
that answers your question, you’re asking too much."