### Install pygeofilter Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Install the core pygeofilter package using pip. ```bash pip install pygeofilter ``` -------------------------------- ### Install pygeofilter with native backend Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Install pygeofilter with the native backend dependencies. ```bash pip install pygeofilter[backend-native] ``` -------------------------------- ### Install pygeofilter with SQLAlchemy backend Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Install pygeofilter with the SQLAlchemy backend dependencies. ```bash pip install pygeofilter[backend-sqlalchemy] ``` -------------------------------- ### Basic Evaluator Setup Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Demonstrates the basic setup for using the Evaluator class with custom filter creation logic. ```python from pygeofilter import ast from pygeofilter.backends.evaluator import Evaluator, handle from myapi import filters # <- this is where the filters are created. # of course, this can also be done in the # evaluator itself ``` -------------------------------- ### Install and Enable pre-commit Hooks Source: https://pygeofilter.readthedocs.io/en/latest/contributing.html Install the pre-commit package and enable its hooks in your local environment. This ensures code formatting and type checking are performed automatically before committing. ```bash # Install pre-commit pip install pre-commit # Enable pre-commit cd /pygeofilter pre-commit install # Optional - run pre-commit manually pre-commit run --all-files ``` -------------------------------- ### Install pygeofilter with Django backend Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Install pygeofilter with the Django backend dependencies. ```bash pip install pygeofilter[backend-django] ``` -------------------------------- ### Install Development Requirements Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Installs development and testing dependencies using pip from requirement files. ```shell pip install -r requirements-dev.txt pip install -r requirements-test.txt ``` -------------------------------- ### Install Development Requirements Source: https://pygeofilter.readthedocs.io/en/latest/index.html Installs development and testing dependencies from requirement files using pip. ```shell pip install -r requirements-dev.txt pip install -r requirements-test.txt ``` -------------------------------- ### Using the Evaluator Class Source: https://pygeofilter.readthedocs.io/en/latest/index.html Demonstrates the basic setup for using the Evaluator class to process ASTs, requiring custom filter creation logic. ```python from pygeofilter import ast from pygeofilter.backends.evaluator import Evaluator, handle from myapi import filters # <- this is where the filters are created. # of course, this can also be done in the # evaluator itself ``` -------------------------------- ### Build Docker Image for Testing Source: https://pygeofilter.readthedocs.io/en/latest/index.html Builds a Docker image tagged 'pygeofilter/test' using a specified Dockerfile. ```shell docker build -t pygeofilter/test -f Dockerfile-3.9 . ``` -------------------------------- ### Build Docker Image for Testing Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Builds a Docker image tagged 'pygeofilter/test' using a specified Dockerfile. ```shell docker build -t pygeofilter/test -f Dockerfile-3.9 . ``` -------------------------------- ### Optimize AST with Static Computation Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Demonstrates how pygeofilter's optimize function can simplify an AST by evaluating static parts of an expression. Use this to reduce the computational cost of filtering by pre-calculating static values. ```python import math from pygeofilter import ast from pygeofilter.parsers.ecql import parse from pygeofilter.backends.optimize import optimize root = parse('attr < sin(3.7) - 5') optimized_root = optimize(root, {'sin': math.sin}) print(ast.get_repr(root)) ``` ```python print(ast.get_repr(optimized_root)) ``` -------------------------------- ### SQL WHERE Clause Generation with Pygeofilter Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Shows how to generate an SQL WHERE clause from a parsed CQL AST using `to_sql_where`. Requires field and function mappings, and is demonstrated with OGR's ExecuteSQL function. ```python from osgeo import ogr from pygeofilter.backends.sql import to_sql_where from pygeofilter.parsers.ecql import parse FIELD_MAPPING = { 'str_attr': 'str_attr', 'maybe_str_attr': 'maybe_str_attr', 'int_attr': 'int_attr', 'float_attr': 'float_attr', 'date_attr': 'date_attr', 'datetime_attr': 'datetime_attr', 'point_attr': 'GEOMETRY', } FUNCTION_MAP = { 'sin': 'sin' } # parse the expression ast = parse('int_attr > 6') # open an OGR DataSource data = ogr.Open(...) # create the WHERE clause, field and function mappings must be provided where = to_sql_where(ast, FIELD_MAPPING, FUNCTION_MAP) # filter the DataSource to get a result Layer layer = data.ExecuteSQL(f""" SELECT id, str_attr, maybe_str_attr, int_attr, float_attr, date_attr, datetime_attr, GEOMETRY FROM layer WHERE {where} """, None, "SQLite") ``` -------------------------------- ### Applying Pygeofilter to Django ORM Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Demonstrates how to parse a CQL expression, convert it to Django ORM filters using `to_filter`, and apply these filters to a Django QuerySet. Requires field and choice mappings. ```python from pygeofilter.backends.django import to_filter from pygeofilter.parsers.ecql import parse cql_expr = 'strMetaAttribute LIKE \'%parent%\' AND datetimeAttribute BEFORE 2000-01-01T00:00:01Z' ast = parse(cql_expr) filters = to_filter(ast, mapping, mapping_choices) qs = Record.objects.filter(**filters) ``` -------------------------------- ### Run Tests with Pytest Source: https://pygeofilter.readthedocs.io/en/latest/index.html Executes the project's tests using the pytest framework. ```shell python -m pytest ``` -------------------------------- ### Run Tests with Pytest Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Executes the project's tests using the pytest framework. ```shell python -m pytest ``` -------------------------------- ### Inspect AST with get_repr Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Use the get_repr function to obtain a string representation of the parsed Abstract Syntax Tree (AST). ```python >>> filters = pygeofilter.parsers.ecql.parse('id = 10') >>> print(pygeofilter.get_repr(ast)) ATTRIBUTE id = LITERAL 10.0 ``` ```python >>> filter_expr = '(number BETWEEN 5 AND 10 AND string NOT LIKE '%B ') OR INTERSECTS(geometry, LINESTRING(0 0, 1 1))' >>> print(pygeofilter.ast.get_repr(pygeofilter.parse(filter_expr))) ( ( ATTRIBUTE number BETWEEN 5 AND 10 ) AND ( ATTRIBUTE string NOT LIKE '%B' ) ) OR ( INTERSECTS(ATTRIBUTE geometry, Geometry(geometry={'type': 'LineString', 'coordinates': ((0.0, 0.0), (1.0, 1.0))})) ) ``` -------------------------------- ### Custom Evaluator Implementation Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Demonstrates how to create a custom evaluator by deriving from the base `Evaluator` class and using the `@handle` decorator to specify which AST node types are processed. ```python class MyAPIEvaluator(Evaluator): # you can use any constructor as you need def __init__(self, field_mapping=None, mapping_choices=None): self.field_mapping = field_mapping self.mapping_choices = mapping_choices # specify the handled classes in the `handle` decorator to mark # this function as the handler for that node class(es) @handle(ast.Not) def not_(self, node, sub): return filters.negate(sub) # multiple classes can be declared for the same handler function @handle(ast.And, ast.Or) def combination(self, node, lhs, rhs): return filters.combine((lhs, rhs), node.op.value) # handle all sub-classes, like ast.Equal, ast.NotEqual, # ast.LessThan, ast.GreaterThan, ... @handle(ast.Comparison, subclasses=True) def comparison(self, node, lhs, rhs): return filters.compare( lhs, rhs, node.op.value, self.mapping_choices ) @handle(ast.Between) def between(self, node, lhs, low, high): return filters.between( lhs, low, high, node.not_ ) @handle(ast.Like) def like(self, node, lhs): return filters.like( lhs, node.pattern, node.nocase, node.not_, self.mapping_choices ) @handle(ast.In) def in_(self, node, lhs, *options): return filters.contains( lhs, options, node.not_, self.mapping_choices ) def adopt(self, node, *sub_args): # a "catch-all" function for node classes that are not # handled elsewhere. Use with caution and raise exceptions # yourself when a node class is not supported. ... # ...further ast handlings removed for brevity ``` -------------------------------- ### Django Field and Choice Mappings Source: https://pygeofilter.readthedocs.io/en/latest/index.html Configuration dictionaries to map Pygeofilter field names to Django model fields and to map choice field values. These are essential for the Django ORM backend. ```python FIELD_MAPPING = { 'identifier': 'identifier', 'geometry': 'geometry', 'floatAttribute': 'float_attribute', 'intAttribute': 'int_attribute', 'strAttribute': 'str_attribute', 'datetimeAttribute': 'datetime_attribute', 'choiceAttribute': 'choice_attribute', # meta fields 'floatMetaAttribute': 'record_metas__float_meta_attribute', 'intMetaAttribute': 'record_metas__int_meta_attribute', 'strMetaAttribute': 'record_metas__str_meta_attribute', 'datetimeMetaAttribute': 'record_metas__datetime_meta_attribute', 'choiceMetaAttribute': 'record_metas__choice_meta_attribute', } MAPPING_CHOICES = { 'choiceAttribute': dict(Record._meta.get_field('choice_attribute').choices), 'choiceMetaAttribute': dict(RecordMeta._meta.get_field('choice_meta_attribute').choices), } ``` -------------------------------- ### Custom API Evaluator Implementation Source: https://pygeofilter.readthedocs.io/en/latest/index.html Demonstrates how to create a custom evaluator by deriving from the base `Evaluator` class and using the `@handle` decorator to specify node types for different methods. This allows for custom handling of Abstract Syntax Tree (AST) nodes representing various filter operations. ```python class MyAPIEvaluator(Evaluator): def __init__(self, field_mapping=None, mapping_choices=None): self.field_mapping = field_mapping self.mapping_choices = mapping_choices @handle(ast.Not) def not_(self, node, sub): return filters.negate(sub) @handle(ast.And, ast.Or) def combination(self, node, lhs, rhs): return filters.combine((lhs, rhs), node.op.value) @handle(ast.Comparison, subclasses=True) def comparison(self, node, lhs, rhs): return filters.compare( lhs, rhs, node.op.value, self.mapping_choices ) @handle(ast.Between) def between(self, node, lhs, low, high): return filters.between( lhs, low, high, node.not_ ) @handle(ast.Like) def like(self, node, lhs): return filters.like( lhs, node.pattern, node.nocase, node.not_, self.mapping_choices ) @handle(ast.In) def in_(self, node, lhs, *options): return filters.contains( lhs, options, node.not_, self.mapping_choices ) def adopt(self, node, *sub_args): ... ``` -------------------------------- ### Parse ECQL and CQL JSON filter expressions Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Import and use the parse functions from the ECQL and CQL JSON sub-packages to parse filter expressions. ```python >>> from pygeofilter.parsers.ecql import parse as parse_ecql >>> filters = parse_ecql(filter_expression) >>> from pygeofilter.parsers.cql_json import parse as parse_json >>> filters = parse_json(filter_expression) ``` -------------------------------- ### Run Tests in Docker Container Source: https://pygeofilter.readthedocs.io/en/latest/index.html Runs the tests within a Docker container, removing the container after execution. ```shell docker run --rm pygeofilter/test ``` -------------------------------- ### Run Tests in Docker Container Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Runs the tests within a Docker container, removing the container after execution. ```shell docker run --rm pygeofilter/test ``` -------------------------------- ### ISO8601Transformer Class Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.parsers.html Handles the transformation of ISO8601 formatted date and time strings. ```APIDOC ## Class: ISO8601Transformer ### Description Transforms ISO8601 formatted date and time strings into a usable format. ### Methods #### DATETIME(dt) - **dt** (type) - Description of the datetime parameter. #### DURATION(duration) - **duration** (type) - Description of the duration parameter. ``` -------------------------------- ### Django Field and Choice Mappings for Pygeofilter Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Specifies dictionaries to map Pygeofilter field names to Django model fields and to map choice field values. These are essential for the Django ORM backend. ```python FIELD_MAPPING = { 'identifier': 'identifier', 'geometry': 'geometry', 'floatAttribute': 'float_attribute', 'intAttribute': 'int_attribute', 'strAttribute': 'str_attribute', 'datetimeAttribute': 'datetime_attribute', 'choiceAttribute': 'choice_attribute', # meta fields 'floatMetaAttribute': 'record_metas__float_meta_attribute', 'intMetaAttribute': 'record_metas__int_meta_attribute', 'strMetaAttribute': 'record_metas__str_meta_attribute', 'datetimeMetaAttribute': 'record_metas__datetime_meta_attribute', 'choiceMetaAttribute': 'record_metas__choice_meta_attribute', } MAPPING_CHOICES = { 'choiceAttribute': dict(Record._meta.get_field('choice_attribute').choices), 'choiceMetaAttribute': dict(RecordMeta._meta.get_field('choice_meta_attribute').choices), } ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.like Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a 'like' filter for GeoPandas objects, similar to SQL LIKE. This function is used for pattern matching on string attributes. ```APIDOC ## pygeofilter.backends.geopandas.filters.like ### Description Creates a 'like' filter. ### Parameters - **_lhs_**: The string attribute to perform pattern matching on. - **_pattern_**: The pattern to match against. - **_nocase_**: Boolean to ignore case during matching. - **_wildcard_**: The wildcard character to use. - **_singlechar_**: The single character wildcard. - **_escapechar_**: The escape character. - **_not_**: Boolean indicating if the condition should be negated (i.e., does not like). ``` -------------------------------- ### pygeofilter.util.like_pattern_to_re_pattern Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.html Converts a LIKE pattern string into a regular expression pattern, returning the pattern string. ```APIDOC ## pygeofilter.util.like_pattern_to_re_pattern ### Description Converts a LIKE pattern string into a regular expression pattern, returning the pattern string. ### Parameters - **_like_** (string) - The LIKE pattern string. - **_wildcard_** (string) - The wildcard character (e.g., '%'). - **_single_char_** (string) - The single character wildcard (e.g., '_'). - **_escape_char_** (string) - The escape character. ``` -------------------------------- ### Django Models for Pygeofilter Integration Source: https://pygeofilter.readthedocs.io/en/latest?badge=latest Defines Django models with various field types, including geometry and choices, for use with Pygeofilter's Django backend. Includes optional field configurations. ```python from django.contrib.gis.db import models optional = dict(null=True, blank=True) class Record(models.Model): identifier = models.CharField(max_length=256, unique=True, null=False) geometry = models.GeometryField() float_attribute = models.FloatField(**optional) int_attribute = models.IntegerField(**optional) str_attribute = models.CharField(max_length=256, **optional) datetime_attribute = models.DateTimeField(**optional) choice_attribute = models.PositiveSmallIntegerField(choices=[ (1, 'ASCENDING'), (2, 'DESCENDING'),], **optional) class RecordMeta(models.Model): record = models.ForeignKey(Record, on_delete=models.CASCADE, related_name='record_metas') float_meta_attribute = models.FloatField(**optional) int_meta_attribute = models.IntegerField(**optional) str_meta_attribute = models.CharField(max_length=256, **optional) datetime_meta_attribute = models.DateTimeField(**optional) choice_meta_attribute = models.PositiveSmallIntegerField(choices=[ (1, 'X'), (2, 'Y'), (3, 'Z')], **optional) ``` -------------------------------- ### pygeofilter.util.like_pattern_to_re Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.html Converts a LIKE pattern string into a regular expression pattern. ```APIDOC ## pygeofilter.util.like_pattern_to_re ### Description Converts a LIKE pattern string into a regular expression pattern. ### Parameters - **_like_** (string) - The LIKE pattern string. - **_nocase_** (boolean) - Whether the match should be case-insensitive. - **_wildcard_** (string) - The wildcard character (e.g., '%'). - **_single_char_** (string) - The single character wildcard (e.g., '_'). - **_escape_char_** (string) - The escape character. ``` -------------------------------- ### WKTTransformer Class Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.parsers.html Parses and transforms Well-Known Text (WKT) geometry representations. ```APIDOC ## Class: WKTTransformer ### Description Parses and transforms Well-Known Text (WKT) geometry representations. ### Methods #### wkt__NUMBER(value) - **value** (type) - Description of the number value. #### wkt__SIGNED_NUMBER(value) - **value** (type) - Description of the signed number value. #### wkt__coordinate(*components) - **components** (type) - Description of the coordinate components. #### wkt__coordinate_list(coordinate_list, coordinate) - **coordinate_list** (type) - Description of the coordinate list. - **coordinate** (type) - Description of a single coordinate. #### wkt__coordinate_list_start(coordinate_list) - **coordinate_list** (type) - Description of the start of a coordinate list. #### wkt__coordinate_lists(*coordinate_lists) - **coordinate_lists** (type) - Description of multiple coordinate lists. #### wkt__geometry_with_srid(srid, geometry) - **srid** (type) - Description of the SRID. - **geometry** (type) - Description of the geometry. #### wkt__geometrycollection(*geometries) - **geometries** (type) - Description of the geometries in a collection. #### wkt__linestring(coordinate_list) - **coordinate_list** (type) - Description of the coordinate list for a linestring. #### wkt__multilinestring(coordinate_lists) - **coordinate_lists** (type) - Description of the coordinate lists for a multilinestring. #### wkt__multipoint(coordinates) - **coordinates** (type) - Description of the coordinates for a multipoint. #### wkt__multipoint_2(*coordinates) - **coordinates** (type) - Description of the coordinates for a multipoint (alternative). #### wkt__multipolygon(*coordinate_lists) - **coordinate_lists** (type) - Description of the coordinate lists for a multipolygon. #### wkt__point(coordinates) - **coordinates** (type) - Description of the coordinates for a point. #### wkt__polygon(coordinate_lists) - **coordinate_lists** (type) - Description of the coordinate lists for a polygon. ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.combine Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Combines multiple filters using a logical combinator (e.g., AND, OR). This allows for the construction of complex filter logic. ```APIDOC ## pygeofilter.backends.geopandas.filters.combine ### Description Combine filters using a logical combinator. ### Parameters - **_sub_filters_**: A list of filters to combine. - **_combinator_**: The logical combinator to use (e.g., 'AND', 'OR'). ``` -------------------------------- ### pygeofilter.util.parse_duration Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.html Parses an ISO 8601 duration string into a python timedelta object. ```APIDOC ## pygeofilter.util.parse_duration ### Description Parses an ISO 8601 duration string into a python timedelta object. Raises a `ValueError` if a conversion was not possible. ### Parameters - **value** (str) - the ISO8601 duration string to parse ### Returns - **datetime.timedelta** - the parsed duration ``` -------------------------------- ### pygeofilter.util.parse_datetime Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.html Parses a string into a datetime object. ```APIDOC ## pygeofilter.util.parse_datetime ### Description Parses a string into a datetime object. ### Parameters - **_value** (str) - The string to parse. ### Returns - **datetime** - The parsed datetime object. ### Return type datetime.datetime ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.bbox Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a bounding box filter for GeoPandas objects. This function is used to filter features that fall within a specified geographic bounding box. ```APIDOC ## pygeofilter.backends.geopandas.filters.bbox ### Description Creates a bounding box filter. ### Parameters - **_lhs_**: The left-hand side operand, typically a geometry column. - **_minx_**: The minimum x-coordinate of the bounding box. - **_miny_**: The minimum y-coordinate of the bounding box. - **_maxx_**: The maximum x-coordinate of the bounding box. - **_maxy_**: The maximum y-coordinate of the bounding box. - **_crs_**: Optional Coordinate Reference System (CRS) for the bounding box. ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.compare Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a comparison filter for GeoPandas objects. This function allows for direct comparison between two operands using various operators. ```APIDOC ## pygeofilter.backends.geopandas.filters.compare ### Description Creates a comparison filter. ### Parameters - **_lhs_**: The left-hand side operand for comparison. - **_rhs_**: The right-hand side operand for comparison. - **_op_**: The comparison operator (e.g., '=', '!=', '>', '<'). ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.between Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a 'between' filter for GeoPandas objects. This function checks if a value falls within a specified range. ```APIDOC ## pygeofilter.backends.geopandas.filters.between ### Description Creates a 'between' filter. ### Parameters - **_lhs_**: The left-hand side operand to check. - **_low_**: The lower bound of the range. - **_high_**: The upper bound of the range. - **_not_**: Boolean indicating if the condition should be negated (i.e., not between). ``` -------------------------------- ### Django Model Definitions Source: https://pygeofilter.readthedocs.io/en/latest/index.html Defines Django models with various field types, including optional fields and fields with choices. These models are used for integrating Pygeofilter with the Django ORM. ```python from django.contrib.gis.db import models optional = dict(null=True, blank=True) class Record(models.Model): identifier = models.CharField(max_length=256, unique=True, null=False) geometry = models.GeometryField() float_attribute = models.FloatField(**optional) int_attribute = models.IntegerField(**optional) str_attribute = models.CharField(max_length=256, **optional) datetime_attribute = models.DateTimeField(**optional) choice_attribute = models.PositiveSmallIntegerField(choices=[ (1, 'ASCENDING'), (2, 'DESCENDING'),], **optional) class RecordMeta(models.Model): record = models.ForeignKey(Record, on_delete=models.CASCADE, related_name='record_metas') float_meta_attribute = models.FloatField(**optional) int_meta_attribute = models.IntegerField(**optional) str_meta_attribute = models.CharField(max_length=256, **optional) datetime_meta_attribute = models.DateTimeField(**optional) choice_meta_attribute = models.PositiveSmallIntegerField(choices=[ (1, 'X'), (2, 'Y'), (3, 'Z')], **optional) ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.arithmetic Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates an arithmetic filter for GeoPandas objects. This function allows for the construction of filters based on mathematical operations between two operands. ```APIDOC ## pygeofilter.backends.geopandas.filters.arithmetic ### Description Creates an arithmetic filter. ### Parameters - **_lhs_**: The left-hand side operand of the arithmetic operation. - **_rhs_**: The right-hand side operand of the arithmetic operation. - **_op_**: The arithmetic operator to apply. ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.null Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a 'null' filter for GeoPandas objects. This function checks if an attribute is NULL or NOT NULL. ```APIDOC ## pygeofilter.backends.geopandas.filters.null ### Description Creates a 'null' filter. ### Parameters - **_lhs_**: The attribute to check for NULL values. - **_not_**: Boolean indicating if the condition should be negated (i.e., not NULL). ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.temporal Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a temporal filter for GeoPandas objects. This function is used for filtering based on time or period values. ```APIDOC ## pygeofilter.backends.geopandas.filters.temporal ### Description Creates a temporal filter. ### Parameters - **_lhs_**: The left-hand side operand, typically a temporal attribute. - **_time_or_period_**: The time or period value to compare against. - **_op_**: The temporal comparison operator. ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.negate Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Negates an existing filter, reversing its logical meaning. This is useful for creating opposite conditions. ```APIDOC ## pygeofilter.backends.geopandas.filters.negate ### Description Negate a filter, opposing its meaning. ### Parameters - **_sub_filter_**: The filter to negate. ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.spatial Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a spatial filter for GeoPandas objects. This function allows for spatial relationship queries between geometries. ```APIDOC ## pygeofilter.backends.geopandas.filters.spatial ### Description Creates a spatial filter. ### Parameters - **_lhs_**: The left-hand side geometry. - **_rhs_**: The right-hand side geometry or spatial object. - **_op_**: The spatial operation to perform (e.g., 'intersects', 'within'). ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.contains Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates a 'contains' filter for GeoPandas objects. This function checks if a geometry contains a set of items. ```APIDOC ## pygeofilter.backends.geopandas.filters.contains ### Description Creates a 'contains' filter. ### Parameters - **_lhs_**: The geometry to check for containment. - **_items_**: The items to check if they are contained within the lhs. - **_not_**: Boolean indicating if the condition should be negated (i.e., does not contain). ``` -------------------------------- ### pygeofilter.backends.geopandas.filters.attribute Source: https://pygeofilter.readthedocs.io/en/latest/api/pygeofilter.backends.geopandas.html Creates an attribute filter for GeoPandas objects. This function is used to filter data based on specific attribute values within a GeoDataFrame. ```APIDOC ## pygeofilter.backends.geopandas.filters.attribute ### Description Creates an attribute filter. ### Parameters - **_df_**: The GeoDataFrame to apply the filter to. - **_name_**: The name of the attribute to filter on. - **_field_mapping_**: Optional mapping for attribute fields. ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.