skillfed

pygeofilter

pygeofilter is a pure Python parser implementation of OGC filtering standards

pygeofilter v0.4.0 75.7K downloads/30d#14,682 on PyPI89
Permissive license MIT Active released

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 pygeofilter

uv

uv add pygeofilter

poetry

poetry add pygeofilter

Installing 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

Development Status :: 3 - AlphaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Scientific/Engineering :: GIS

Tags

OGC filter parsingCQL parsergeospatial query filteringOGC API features filteringfilter expression evaluationspatial query languagegeographic data filtering
geospatialogc-standardsquery-parsing

More GIS packages