The mapfish.lib.filters module. This module’s sub-modules include filter implementations.
Filters are commonly created in the index() action of MapFish controllers and passed to the protocol instance through the filter positional argument of the protocol index() method.
Example:
class CountriesController(BaseController):
readonly = True # if set to True, only GET is supported
def __init__(self):
self.protocol = Protocol(Session, Country, self.readonly)
def index(self, format='json'):
# complement the MapFish default filter so only features
# in the [5, 45, 6, 50] extent are returned
filters = [
create_default_filter(request, Country),
Spatial(
Spatial.BOX,
Country.geometry_column(),
box=[5, 45, 6, 50]
)
]
filter = Logical(Logical.AND, filters=filters)
return self.protocol.index(request, response, format=format, filter=filter)