--- id: pygeofilter version: "0.4.0" license: MIT license_treatment: permissive maintenance: active --- # pygeofilter — pygeofilter is a pure Python parser implementation of OGC filtering standards License: permissive · Maintenance: active · Downloads: 75.7K/mo ## 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 above — 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 pip install pygeofilter uv add pygeofilter 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: unspecified - Install friction: low - Maintenance: active - Downloads: 75.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags OGC filter parsing, CQL parser, geospatial query filtering, OGC API features filtering, filter expression evaluation, spatial query language, geographic data filtering, geospatial, ogc-standards, query-parsing [View on SkillFed](https://skillfed.io/packages/pygeofilter) · [View on PyPI](https://pypi.org/project/pygeofilter/)