Skip to main content

Layer filtering

Filtering by attribute

Geogirafe offers attribute filtering for WMS layers.

Precondition

  • Layer is a WMS layer
  • Layer needs to be queryable: the queryable flag is set to true in themes.json
  • The associated WFS provides filtering capabilities

Filter capabilities

Each data type supports a set of filter operators:

  • String Attributes

    • equal, not equal, like, not like, null, not null
  • Numeric Attributes

    • equal, not equal, greater than, greater or equal than, lesser than, lesser or equal than, between, null, not null
  • Date Attributes

    • equal, not equal, before, after, between, not null

Note: date filters only supports filtering based on dates (day resolution). The temporal filter below offers more advanced temporal filtering capabilities such as monthly or yearly resolutions or time sliders.

Data types per attribute are read from the WFS DescribeFeatureType response.

Filtering by time

Layers with a temporal dimension can be filtered with a special time filter that allows more possibilities than regular attribute filtering.

Preconditions

  • Layer is a WMS layer
  • Layer must be configured with a time dimension
  • The associated WFS provides filtering capabilities

Configuration in themes.json

Layers need to have flag "queryable": true in order to support time-based filtering.

To make a layer filterable by time, themes.json has to contain the following configuration:

  • layer > metadata > timeAttribute: Name of the attribute containing the temporal dimension
  • layer > time: Configuration as ITimeOptions; defines how the UI element should behave and look like, and what time values are accepted
interface ITimeOptions {
minValue: string; // Lower limit of time values
maxValue: string; // Upper limit of time values
minDefValue: string | null; // Default / initial value, lower range (optional)
maxDefValue: string | null; // Default / initial value, upper range (optional)
values?: string[]; // List of explicit time values (optional)
interval: [number, number, number, number]; // [Not used]
resolution: string; // Time resolution [day, week, month, year]
mode: string; // Widget mode [range, value]
widget: string; // UI time widget to display [slider, datepicker]
}

Handling of time-aware layers in GeoGirafe

The time configuration (ITimeOptions) and the currently defined time restriction are saved to the layer object (e.g. WmsLayer.ts).

class LayerWms {
// [...]
public timeOptions?: ITImeOptions; // Configuration from theme.json as ITimeOption
public timeRestriction?: string; // Currently active time filter, e.g. '2020-01/2022-01'
public timeAttribute?: string; // Name of attribute containing temporal dimension, e.g. 'dateTaken'
}

Time filtering works in the same way as standard attribute filtering: As soon as the attribute timeRestriction changes its value, a state change is detected and WmsClient and WfsClient send requests with updated filter arguments to the backend.

Temporal filter query

For the WMS part of the layer, a TIME URL parameter is formulated and added to the query URL. The value of the parameter depends on the configuration (resolution, mode). For example, if the resolution is month, the parameter will look like this: TIME=2020-01/2022-01.

For the WFS part, there are two ways in which GeoGirafe sends temporal filter queries to the backend:

  1. An XML-based temporal filter query using the <during> operator (see openlayer during filter), added to the body of the request
  2. A URL parameter TIME, added to the URL of the request (same as WMS)

Option 1 is used if the layer metadata specifies a timeAttribute. Otherwise, option 2 is used. For option 1 to work, the WFS must support the <during> filter operator.