CQL and ECQL

本文介绍了GeoServer中用于WMS和WFS请求的CQL和ECQL查询语言,包括它们的用途、语法示例以及在动态渲染图层中的应用。CQL是一种更易读的查询语言,而ECQL则扩展了CQL的功能,提供更灵活的查询选项。通过一系列示例,展示了如何使用这些语言进行属性和几何过滤,如范围查询、文本匹配、算术表达式以及几何过滤等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文讲述了如何使用CQL and ECQL查询语言,文章摘自GeoServer官网。在GeoServer的WMS和WFS动态渲染图层,并通过不同的例子具体说明。其中CQL and ECQL查询语言放置在定义WMS和WFS图层的params中,示例代码如下:

var WMSsource = new ol.source.ImageWMS({
    ratio: 1,
    url: 'http://wangxch:8081/geoserver/QHH/wms',
    params: {
        'FORMAT': format,
        'VERSION': '1.1.1',
        "LAYERS": 'QHH:p242landownershipP',
        "exceptions": 'application/vnd.ogc.se_inimage',
        'CQL_FILTER': "province=xining" //过滤条件
    }
});

CQL (Common Query Language) is a query language created by the OGC for the Catalogue Web Services specification. Unlike the XML-based Filter Encoding language, CQL is written using a familiar text-based syntax. It is thus more readable and better-suited for manual authoring.

However, CQL has some limitations. For example it cannot encode id filters, and it requires an attribute to be on the left side of any comparison operator. For this reason, GeoServer provides an extended version of CQL called ECQL. ECQL removes the limitations of CQL, providing a more flexible language with stronger similarities with SQL.

GeoServer supports the use of both CQL and ECQL in WMS and WFS requests, as well as in GeoServer’s SLD dynamic symbolizers. Whenever the documentation refers to CQL, ECQL syntax can be used as well (and if not, please report that as a bug!).

This tutorial introduces the CQL/ECQL language by example. For a full reference, refer to the ECQL Reference.

Getting started

The following examples use the topp:states sample layer shipped with GeoServer. They demonstrate how CQL filters work by using the WMS 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值