GeoPython 2022

pygeofilter: geospatial filtering made easy
2022-06-21, 11:45–12:15, Room 2

pygeofilter helps integrating geospatial filters in any Python application. Batteries included.


Abstract

pygeofilter is a library to support the integration of geospatial filters. It is split into frontend language parsers (CQL 1 + 2 text/JSON, JFE, FES) , a common Abstract Syntax Tree (AST) representation and several backends (database systems) where the parsed filters can be integrated into queries.

Parsers

Currently pygeofilter supports CQL 1, CQL 2 in both text and JSON encoding, OGC filter encoding specification (FES) and JSON filter expressions (JFE) as input languages. Additionally pygeofilter provides utilities to help create parsers for new filter languages.
The filters are parsed to an AST representation, which is a common denominator across all filter capabilities including logical and arithmetic operators, geospatial comparisons, temporal filters and property lookups. An AST can also be easily created via the API, if necessary.

Backends

pygeofilter provides several backends and helpers to roll your own. Built-in backends are for Django, SQLAlchemy, raw SQL, (Geo)Pandas dataframes, and native Python lists of dicts or objects.

Usage

pygeofilter is used in several applications, such as PyCSW, EOxServer and ogc-api-fast-features