ECQL Syntax Specification

ECQL (Extended Common Query Language) is an extension of the OGC standard query language CQL. Compared to CQL, it is more powerful and flexible, with syntax closer to SQL. It is primarily used for filtering and querying geographic spatial data. You can intuitively combine SQL-style attribute filtering (e.g., POPULATION > 100000) with rich spatial relationship evaluations (e.g., INTERSECTS, WITHIN) to precisely filter target datasets. The following lists some common ECQL syntax.

Special Note: In the SuperMap GIS environment, support for ECQL Query functionality is closely related to the data engine type. ECQL filter queries are only supported when using JDBC-PostGIS connections. Starting from SuperMap 2025 R2, support for ECQL Query has also been added when using JDBC-OracleSpatial connections. It is important to note that when using JDBC-OracleSpatial connections, temporal predicates (e.g., BEFORE, AFTER, DURING) and spatial functions RELATE() and BEYOND() in ECQL are not supported.

Attribute Query

Category Function/Operator Syntax Example
Logical Relation Evaluation AND, OR, NOT pop_2014 < 10000 AND popUrban_2014 > 5000;
NOT DLMC = 'Paddy Field';
"Parcel Type" = 'Woodland';
Comparison Operators​ =, <>, >, >=, <, <= PERSONS > 15000000;
STATE_NAME = 'California';
Range Query​​ BETWEEN ... AND ... PERSONS BETWEEN 1000000 AND 3000000;
Fuzzy Match​​ LIKE/ ILIKE STATE_NAME LIKE 'N%';
cityName ILIKE 'new%';
Set Evaluation​​ IN (...) STATE_NAME IN ('New York', 'California');
​​Null Value Evaluation​​ IS NULL/ IS NOT NULL Name IS NULL;
centroid(the_geom) IS NULL;

Spatial Query

Function Name Syntax Example Description
INTERSECTS INTERSECTS(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9));
INTERSECTS(geom, SRID=4326, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9));
Determines whether two spatial objects intersect.
DISJOINT​ DISJOINT(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9));
DISJOINT(geom, SRID=4326, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9));
Determines whether two spatial objects are disjoint.
CONTAINS​ CONTAINS(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether the POLYGON spatial object completely contains the geom spatial object.
WITHIN​ WITHIN(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether the geom object is completely within the POLYGON spatial object.
TOUCHES​ TOUCHES(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether the boundaries of two spatial objects touch.
CROSSES​ CROSSES(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether two spatial objects cross (e.g., a line crossing a polygon).
OVERLAPS​ OVERLAPS(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether two spatial objects overlap.
EQUALS​ EQUALS(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9)) Determines whether two spatial objects are topologically equal.
DWITHIN​ DWITHIN(geom, POINT(116.4 39.9), 10, kilometers) //Finds spatial objects within 10 kilometers of the point. Finds geometries within a specified distance range.
BEYOND BEYOND(geom, POINT(116.4 39.9), 10, kilometers) // Finds spatial objects beyond 10 kilometers from the point. Finds geometries beyond a specified distance range.
BBOX BBOX(geom, minX, minY, maxX, maxY);
BBOX(geom, 103.4,39.9,104.5,40.6,'EPSG:4326');
Queries geometries that intersect a given bounding box.
RELATE​ RELATE(geom, POLYGON(116.4 39.9,116.4 40.3,117.4 40.3,117.4 39.9,116.4 39.9), 'T*****FF*') Evaluates the topology between two geometries based on the DE-9IM (Dimensionally Extended 9-Intersection Model).

Note: The "geom" above refers to the geometry field of the spatial data.

Temporal Query

Function Name Syntax Example Description
BEFORE lastEarthQuake BEFORE 2006-11-30T01:30:00Z Determines whether a time point is before the specified time.
AFTER lastEarthQuake AFTER 2006-11-30T01:30:00Z Determines whether a time point is after the specified time.
TEQUALS ATTR1 TEQUALS 2006-11-30T01:30:00Z Determines whether a time point equals the specified time.
DURING lastEarthQuake DURING 1700-01-01T00:00:00/2011-01-01T00:00:00 Determines whether a time point or interval is contained within another time interval.