3

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:

uding guide for CQL

closed as too broad by PolyGeo Aug 17 '16 at 23:16

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

3

The CQL is defined by the OGC as part of the catalogue service (i.e. CSW) model specification. See http://docs.opengeospatial.org/is/12-168r6/12-168r6.html for the current (as of July 2016) version. GeoTools claims support for 2.0.1, which you can find linked off http://www.opengeospatial.org/standards/cat in the deprecated spec section.

For the GeoTools specific part, there is design documentation in the source repo at https://github.com/geotools/geotools/blob/master/modules/library/cql/CQL.md and of course, you can review the source any time :-)

Note that the language is extensible, so if you are working GeoTools / GeoServer (or uDig) then you can use the GeoTools ECQL extensions: http://docs.geotools.org/latest/userguide/library/cql/ecql.html (note design document linkage off that page, or see https://github.com/geotools/geotools/blob/master/modules/library/cql/ECQL.md)

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