Common Query Language

Common Query Language (CQL) is a formal language for representing queries to Information retrieval systems such as web indexes, bibliographic catalogs and museum collection information. The design objective is that queries be human readable and writable, and that the language be intuitive while maintaining the expressiveness of more complex languages.

Traditionally, query languages have fallen into two camps: powerful, expressive languages, not easily readable or writable by non-experts (e.g. SQL, PQF, and XQuery); or simple and intuitive languages not powerful enough to express complex concepts (e.g. CCL and Google).

CQL tries to combine simplicity and intuitiveness of expression for simple, every day queries, with the richness of more expressive languages to accommodate complex concepts when necessary.

WMS uses CQL in the request to filter the returned response. This capability provides enhanced flexibility and better user control over response results for sophisticated users of the services.

The parameter name coverage_cql_filter is used for GetMap requests and the parameter name cql_filter is used for GetFeatureInfo requests.

CQL Filter Principle

The following examples illustrate CQL filter principles and their usage.

WFS Examples

WMS Examples

How to Combine Two Attributes in a CQL Filter

There are two approaches to combining two attributes in a CQL Filter.

  • Post syntax (xml)
  • get syntax (CQL-based)

The filter can be an arbitrarily complex expression, such as:

property = value

or

(property = value)AND(otherProperty > otherValue)

Sub-expressions can be put together with AND and OR to form more complex expressions.

The following table lists the possible CQL Filter parameters.

The CQL filter parameters can be determined by running a DescribeFeatureType request. See Web Feature Service.

CQL Filter Parameters
ElementDataTypeExample ValueExample UsageDescription
featureIdstring17027d713c0c3d9eaef07e80d959e347featureId='17027d713c0c3d9eaef07e80d959e347'A string that uniquely identifies the particular Feature to be included or excluded from returned results.
geometrygml:GeometryPropertyType34.068123,-96.509471,34.098737,-96.472678BBOX(geometry,34.068123,-96.509471,34.098737,-96.472678)A GML polygon representing the geometry of the Feature instance; the GML includes the Coordinate System of the polygon.
acquisitionDatestring2009-05-27 01:20:43.63599acquisitionDate>='2009-05-27 01:20:43.63599'For source_unit="Strip", the GMT of acquisition of the image used to make the product described by the Feature; for other source_unit values, the GMT of acquisition of the oldest image contained in the product described by the Feature.
acquisitionTimeint1753acquisitionTime='1753'Time of acquisition date in HHMM format
sensorTypestringDo not include  
sourcestringWV01source='WV01'The sensor used to collect the imagery used to make the product described by the Feature.
sourceUnitstringStripsourceUnit='Strip'The type of product described by the Feature.
productTypestringPanchromaticproductType='Panchromatic'The type of product described by the Feature. Pan Sharpened Natural Color Panchromatic
CE90Accuracystring4.21CE90Accuracy<=4.21The geographic accuracy of the product described by the Feature, in Meters, as a CE90 value. CE90, Circular Error of 90%, is commonly used for quoting and validating geodetic image registration accuracy. A CE90 value is the minimum diameter of the horizontal circle that can be centered on all photoidentifiable Ground Control Points (GCPs) and also contain 90% of their respective twin counterparts acquired in an independent geodetic survey.
RMSEAccuracystring7.63RMSEAccuracy<=7.63The geographic accuracy of the product described by the Feature, in Meters, as a 2d RMS Error value. RMSE, Root Mean Squared Error, is commonly used for quoting and validating geodetic image registration accuracy. A RMSE value is a single summary statistic that describes the square-root of the mean horizontal distance between all photo-identifiable GCPs and their respective twin counterparts acquired in an independent geodetic survey.
cloudCoverfloat0.5cloudCover<=0.5The cloud cover percentage of the image used to make the product described by the Feature; this will be 0 for products made from more than one image.
offNadirAnglefloat37.6offNadirAngle<=37.6The off-nadir angle of the image used to create the product described by the Feature; this will be null for products made from more than one image.
sunElevationfloat83.5sunElevation<=83.5The elevation angle of the sun for the image used to make the product described by the Feature; this will be null for products made from more than one image.
sunAzimuthfloat-117.3sunAzimuth>=-117.3The azimuth angle of the sun for the image used to make the product described by the Feature; this will be null for products made from more than one image.
groundSampleDistancefloat0.5groundSampleDistance=0.5The GSD of the product described by the Feature.
groundSampleDistanceUnitstringMetergroundSampleDistanceUnit='Meter'The units of the field groundSampleDistance.
dataLayerstringdaily_takedataLayer='daily_take'

Defines the layer in which the product described by the Feature exists.

  • crisis_event (FirstLook - Natural and human caused disasters)

  • country_coverage (Global Basemap Countries)

  • metro (Global Basemap Cities)

  • aerial_cells (Global Basemap Aerial Cells. U.S. and Western Europe Coverage only)

  • aerial_markets (GBM Aerial Markets/urban areas. US and Western EU)

  • aerial_cir_cells (Color infrared version of aerial cells)

  • aerial_cir_markets (Color infrared version of aerial markets)

  • monitoring (AssuredLook – monitoring of selected sites)

legacyDescriptionstringAOI4_L3_WV2legacyDescription='AOI4_L3_WV2'A text description of the product described by the Feature.
outputMosaicbooleanTRUEoutputMosaic=TRUETrue if the product described by the Feature consists of multiple images, as in the case of a Region Tile; "False" if the product type is Strip.
colorBandOrderstringRGBcolorBandOrder='RGB'Null for panchromatic data; otherwise the order in which the spectral bands occur in the product described by the Feature.
assetNamestringFINISHEDassetName='FINISHED'The Name of the catalog that contains the Product described by the Feature.
assetTypestringPRODUCT_GEOMETRYassetType='PRODUCT_GEOMETRY'The Type of the catalog that contains the Product described by the Feature.
legacyIdstring10300100AE766C00legacyId='10300100AE766C00'If source_unit is "Strip", this is the Maxar internal identifier of the image used to make the product described by the Feature; for other source_units, this field is null.
factoryOrderNumberstring052187237-10factoryOrderNumber='013291395-10'The order number that identifies the product described by this Feature within the Maxar internal systems.
perPixelXfloat4.50E-06perPixelX<=0.0000045The pixel size in the x direction; the unit is determined by the "crsFromPixels" value.
perPixelYfloat4.50E-06perPixelY<=0.0000045The pixel size in the y direction; the unit is determined by the "crsFromPixels" value.
crsFromPixelsstringEPSG:4326crsFromPixels='EPSG:4326'The Coordinate Reference System of the Product described by the Feature.
urlstring   
ageDaysint14ageDays<14The age (in days) of the image from today's date.
formattedDatestring2021-06-21formattedDate='2021-06-21'Ingest date without timestamp
ingestDatestring2010-06-21 13:20:43.63599ingestDate<='2020-06-21 13:20:43.63599'The GMT time at which the Feature was made available in SecureWatch.
spatialAccuracystring1:50,000spatialAccuracy='1:50,000'The accuracy of the product described by the Feature, using the NMAS accuracy scales. National map accuracy standards are specifications of accuracy standards for well-defined map points on published maps that are specified by the U.S. Geological Survey and revised by the U.S. Bureau of the Budget.
earliestAcquisitionDatestring2021-06-28 17:53:56earliestAcquisitionDate='2021-06-28 17:53:56'Earliest date of imagery acquisition
latestAcquisitionDatestring2021-06-28 17:53:56latestAcquisitionDate='2021-06-28 17:53:56'Latest date of imagery acquisition
pixelsIngestedbooleantruepixelsIngested=true 
preciseGeometrybooleantruepreciseGeometry=true 
vendorNamestring   
vendorReferencestring   
companyNamestring   
acquisitionTypestring   
orbitDirectionstring   
licenseTypestring   
isBrowsebooleanfalseisBrowse=falseTrue = Browse, non-native resoultion; False = Native resolution
isMirroredbooleanfalseisMirrored=falseTrue = image has been mirrored, False = non-mirrored image
isMultipleWKBbooleanfalseisMultipleWKB=falseTrue = multiple objects, False = single object
copyrightstring   
beamModestring   
polarisationModestring   
polarisationChannelstring   
antennaLookDirectionstring   
minimumIncidenceAnglefloat   
maximumIncidenceAnglefloat   
incidenceAngleVariationfloat   
niirsfloat5.1niirs>=5.1National Imagery Interpretability Rating Scale value
verticalAccuracyfloat   
tagsAsStringstring