pygeofilter
pygeofilter is a pure Python parser implementation of OGC filtering standards
What it is and what it does
pygeofilter is a pure Python parser that converts OGC (Open Geospatial Consortium) filter standards into a unified abstract syntax tree representation. It handles multiple input formats—CQL as defined in CSW 2.0, CQL JSON from OGC API Features Part 3, JSON Filter Expressions (JFE), and FES—allowing you to parse geographic and attribute filtering queries from different sources into a common intermediate form.
Once parsed, the AST can be evaluated and transformed into backend-specific queries. The package includes pre-built evaluators for Django ORM, SQLAlchemy, GeoPandas, Elasticsearch, OpenSearch, and native Python object filtering, so you can apply the same parsed filter expression across different data stores. It also provides an Evaluator base class and a command-line utility for testing and inspecting parsed expressions.
Use it for:
- Parse and apply OGC-compliant filter expressions in a web service that needs to support multiple query languages
- Convert CQL queries from OGC API Features clients into Django ORM or SQLAlchemy filters for database queries
- Build a geospatial search API that accepts CQL JSON and evaluates filters against GeoPandas DataFrames or Elasticsearch indices
- Inspect and debug filter expressions by converting them to a readable AST representation via the command-line tool
- Implement custom filtering logic by extending the Evaluator class to handle domain-specific filter backends
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses OGC filtering standards (CQL, CQL JSON, JFE, FES) into an abstract syntax tree that can be evaluated against Django, SQLAlchemy, GeoPandas, Elasticsearch, OpenSearch, or native Python objects.
Yes. The package fills a specific, well-defined role in OGC-compliant geospatial applications. It is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and carries low installation friction. Install it if you need to parse or evaluate OGC filter standards; skip it if your application does not work with OGC APIs or CQL.
Install
pygeofilter on PyPI
pip
pip install pygeofilteruv
uv add pygeofilterpoetry
poetry add pygeofilterInstalling pygeofilter
Before you install
Low friction installation with four runtime dependencies (click, dateparser, lark, pygeoif). Active maintenance with a release 67 days ago; repository shows 89 stars and recent activity.
License in practice
MIT license permits commercial and private use with minimal restrictions; you must include a copy of the license and copyright notice.
Quickstart
pip install pygeofilter
from pygeofilter.parsers.ecql import parse as parse_ecql
filters = parse_ecql('id = 10')
from pygeofilter import get_repr
print(get_repr(filters))
Verify before relying
- Whether all advertised backends (Django, SQLAlchemy, GeoPandas, Elasticsearch, OpenSearch) are fully functional or some remain experimental
- Performance characteristics when parsing or evaluating large or deeply nested filter expressions
- Whether optional backend dependencies are automatically installed or must be manually specified
Package facts
| License | MIT (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — click, dateparser, lark, pygeoif |
| Maintenance | actively maintained — 67 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 75,738/month — #14,682 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pygeofilter-0.4.0-py2.py3-none-any.whl
Tags
More GIS packages
Shapely provides Python tools for creating,…
permissive · top 1,000 on PyPI
pyprojpyproj provides a Python interface to PROJ,…
permissive · top 1,000 on PyPI
geopandasGeoPandas extends pandas DataFrames to handle…
permissive · top 1,000 on PyPI
geopygeopy is a Python client for geocoding and…
permissive · top 5,000 on PyPI
pyogrioPyogrio provides fast, bulk-oriented read and…
permissive · top 5,000 on PyPI
h3h3 provides Python bindings to Uber's H3…
permissive · top 5,000 on PyPI
pygeoifPyGeoIf provides lightweight, pure-Python…
copyleft · top 15,000 on PyPI
GeoAlchemy2GeoAlchemy2 extends SQLAlchemy to work with…
permissive · top 5,000 on PyPI
cql2Parses, validates, and converts Common Query…
permissive · top 15,000 on PyPI
django-filterDjango-filter adds dynamic QuerySet filtering…
permissive · top 5,000 on PyPI
fastapi-filterAdds declarative filtering, sorting, and…
permissive · top 15,000 on PyPI
promql-parserParses Prometheus query language (PromQL)…
unclear · top 15,000 on PyPI
django-elasticsearch-dsl-drfProvides Django REST framework views,…
copyleft · top 15,000 on PyPI
owslibOWSLib provides Python client access to Open…
permissive · top 15,000 on PyPI
geojsonEncodes, decodes, and represents GeoJSON…
permissive · top 5,000 on PyPI
djangorestframework-filtersExtends Django REST Framework with advanced…
permissive · top 15,000 on PyPI