Skip to content

Module tifeatures.filter.evaluate

tifeatures.filter.evaluate.

Variables

LITERALS

Functions

to_filter

def to_filter(
    ast,
    field_mapping=None
)

Helper function to translate ECQL AST to Django Query expressions.

Parameters:

Name Type Description Default
ast :class:Node the abstract syntax tree None
field_mapping None a dict mapping from the filter name to the Django field lookup. None
mapping_choices None a dict mapping field lookups to choices. None

Returns:

Type Description
:class:django.db.models.Q a Django query object

Classes

BuildPGEvaluator

class BuildPGEvaluator(
    field_mapping
)

Base class for AST evaluators.

Ancestors (in MRO)

  • pygeofilter.backends.evaluator.Evaluator

Class variables

handler_map

Methods

adopt

def adopt(
    self,
    node,
    *sub_args
)

Interface function for a last resort when trying to evaluate a node

and no handler was found.

adopt_result

def adopt_result(
    self,
    result: Any
) -> Any

Interface function for adopting the final evaluation result

if necessary. Default is no-op.

arithmetic

def arithmetic(
    self,
    node,
    lhs,
    rhs
)

attribute

def attribute(
    self,
    node
)

bbox

def bbox(
    self,
    node,
    lhs
)

between

def between(
    self,
    node,
    lhs,
    low,
    high
)

combination

def combination(
    self,
    node,
    lhs,
    rhs
)

comparison

def comparison(
    self,
    node,
    lhs,
    rhs
)

envelope

def envelope(
    self,
    node
)

evaluate

def evaluate(
    self,
    node: Union[ForwardRef('Node'), pygeofilter.values.Geometry, pygeofilter.values.Envelope, datetime.date, datetime.datetime, datetime.timedelta, pygeofilter.values.Interval, bool, float, int, str, list],
    adopt_result: bool = True
) -> Any

Recursive function to evaluate an abstract syntax tree.

For every node in the walked syntax tree, its registered handler is called with the node as first parameter and all pre-evaluated child nodes as star-arguments. When no handler was found for a given node, the adopt function is called with the node and its arguments, which by default raises an NotImplementedError.

function

def function(
    self,
    node,
    *arguments
)

geometry

def geometry(
    self,
    node
)

in_

def in_(
    self,
    node,
    lhs,
    *options
)

interval

def interval(
    self,
    node,
    start,
    end
)

like

def like(
    self,
    node,
    lhs
)

literal

def literal(
    self,
    node
)

not_

def not_(
    self,
    node,
    sub
)

null

def null(
    self,
    node,
    lhs
)

spatial_distance

def spatial_distance(
    self,
    node,
    lhs,
    rhs
)

spatial_operation

def spatial_operation(
    self,
    node,
    lhs,
    rhs
)

spatial_pattern

def spatial_pattern(
    self,
    node,
    lhs,
    rhs
)

temporal

def temporal(
    self,
    node,
    lhs,
    rhs
)