https://github.com/developmentseed/cql2-rs
Rust library and Python bindings for parsing the OGC CQL2 filter language
https://github.com/developmentseed/cql2-rs
Last synced: 5 days ago
JSON representation
Rust library and Python bindings for parsing the OGC CQL2 filter language
- Host: GitHub
- URL: https://github.com/developmentseed/cql2-rs
- Owner: developmentseed
- License: mit
- Created: 2024-07-15T14:18:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-04-20T12:00:13.000Z (7 days ago)
- Last Synced: 2026-04-20T13:43:01.230Z (7 days ago)
- Language: Rust
- Homepage: http://developmentseed.org/cql2-rs/
- Size: 9.61 MB
- Stars: 22
- Watchers: 5
- Forks: 2
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# cql2-rs
[](https://github.com/developmentseed/cql2-rs/actions/workflows/ci.yml)
Parse, validate, and convert [Common Query Language (CQL2)](https://www.ogc.org/standard/cql2/) text and JSON.
## Usage
### API
```toml
[dependencies]
cql = "0.4"
```
Then:
```rust
use cql2::Expr;
let expr: Expr = "landsat:scene_id = 'LC82030282019133LGN00'".parse().unwrap();
assert!(expr.is_valid());
println!("{}", expr.to_json().unwrap());
```
See [the documentation](https://docs.rs/cql2) for more.
## CLI
See [the cql2-cli README](./cli/README.md) for details.
## Responses
Responses may not match the input.
### cql2-text differences
- All identifiers in output are double quoted
- The position of "NOT" keywords is standardized to be before the expression (ie "... NOT LIKE ..." will become "NOT ... LIKE ..."
- The negative operator on anything besides a literal number becomes "* -1"
- Parentheses are added around all expressions
## Development
Get [uv](https://docs.astral.sh/uv/getting-started/installation/) and [Rust](https://rustup.rs/).
Then:
```shell
git clone git@github.com:developmentseed/cql2-rs.git
cd cql2-rs
uv sync
scripts/test
```
To lint all files:
```shell
scripts/lint
```
To serve the docs locally:
```shell
uv run mkdocs serve # http://127.0.0.1:8000/cql2-rs/
```
See [CONTRIBUTING.md](./CONTRIBUTING.md) for more information about contributing to this project.
## License
**cql2-rs** is licensed under the MIT license.
See [LICENSE](./LICENSE) for details.