As of Weave 2.6.6 it’s possible to define filters that can be associated with a map layer. The filters are used when the layer is drawn to refine the set of features that will be rendered for the layer. Additionally, a new client panel allows the user to dynamically alter the filter, giving them the ability to dynamically refine the features displayed on the map.
This is similar to the search panel where the user can enter certain criteria to select a set of entities, but in this case, the input the user enters is used to refine the set of features displayed on the map. For example, if the map contains a layer representing the public reserves, a filter could be created for the reserves layer that allows the user to display only those reserves containing a specific facility or facilities, i.e. only those reserves with barbeques and/or public toilets.
The panel to include in the client to allow the user to alter the filters has the id weave.layerFilter
.
The client UI for the filtering contains a couple of new controls that were not previously available with other input forms, the slider and multi-slider. These controls are useful for layer filtering because they provide an easier way to constrain a numeric value to a certain range but they’re also different in that they force a value to have to be chosen, that is a filter the uses a slider for a value will always have that value applied when displaying the layer, which can be important when the table behind the layer contains a number of “sets” of data but only one should be displayed at a time, and the column behind the parameter is used to separate out the data into the various sets, for example, this could be the year when the data in the table was generated and the user would only want to see a single year at a time, or for a layer with flood levels and you only want to show a single depth.
Current limitations
There can be only one filter associated with a particular map layer, this is unlikely to change.
Grouped or cascade parameters are not supported, this may change depending upon demand.
The filtering only affects the display of the layer on the map, it plays no part for example if the user tries to spatially select entities that are associated with that layer, this may change depending upon demand.
Configuration
Namespace
urn:com.cohga.weave.map.filter#1.0
Tags
layer
Properties
Name | Type | Required | Description |
id | string | yes | Unique identifier for this filter |
label | string | yes | Text to be displayed to the user to represent this filter |
mapengine | string | yes | The identifier of the map engine the layer to filter belongs to |
layer | string | yes | The identifier of the layer in the map engine this filter applies to |
Sub-tags
Name | Type | Cardinality |
parameter | urn:com.cohga.weave.map.filter#1.0:parameter | 0..n |
parameter
Properties
Name | Type | Required | Default | Description |
id | string | yes | A unique identifier for the parameter | |
label | string | yes | The prompt text displayed when user input the parameter value | |
column | string | yes | The name of the column within the layer that this parameter references. | |
controlType | 'text', '‘list', 'radio', ‘check', ‘multicheck’, 'silder’, 'multislider’ | no | 'text' | The UI control to use when displaying the parameter |
dataType | 'boolean', 'float', 'integer', 'string' | no | 'string' | The data type for the parameter |
allowBlank | boolean | no | true | Give the user the choice of an empty value in the listbox (as opposed to a null value) |
value | any | no | The default value of the parameter (except multislider fields) | |
dataSet | no | Where to get the values for a listbox | ||
labelColumn | string | no | Column in the datadefinition that supplies the label of the value to show the user | |
valueColumn | string | no | Column in the datadefinition that supplies the value of the value to use in the SQL | |
scalarparametertype | string | no | 'simple' | 'simple' or 'multi-value' to determine of more than one value can be selected from a list. |
width | integer | no | Set the width of the field | |
minValue | number | yes - for slider and multislider | The minimum value allowed for a numeric field. | |
maxValue | number | yes - for slider and multislider | The maximum value allowed for a numeric field. | |
leftValue | number | no | The initial minimum value for a multislider | |
rightValue | number | no | The initial maximum value for a multislider | |
increment | number | no | The increment to use for fields that support it, the units are dependant upon the field type. | |
trueValue | any | no | The value that equates to "true" in the underlying table, only suitable for checkboxes | |
falseValue | any | no | The value that equates to "false" in the underlying table, only suitable for checkboxes | |
decimalPrecision | number | no | The precision of any numeric fields |
Sub-tags
Name | Type | Cardinality |
list | urn:com.cohga.weave.map.filter#1.0:list | 1..1 - only for radio and multicheck fields |
list
Properties
Name | Type | Required | Description |
value | string | yes | Value to be used in the filter |
label | string | yes | Text to be displayed to the user to represent this filter |
checked | string | no | Should this check box be initially checked. Only for list within multicheck field |
Examples
<?xml version="1.0" encoding="UTF-8"?> <config xmlns="urn:com.cohga.server.config#1.0" xmlns:filter="urn:com.cohga.weave.map.filter#1.0" xmlns:data="urn:com.cohga.server.data.database#1.0"> <!-- provide the values for the title names list --> <data:datadefinition id="titles.names"> <datasourcedataconnection datasource="main" table="TITLES" prefix="DISTINCT"> <parameter name="title_name" label="Title Name" column="TITLENAME"/> </datasourcedataconnection> </data:datadefinition> <!-- create a simple list parameter to filter on title name --> <filter:layer id="titles"> <label>Titles</label> <mapengine>main</mapengine> <layer>titles</layer> <parameter id="name"> <label>Name</label> <controlType>list</controlType> <scalarParameterType>multi-value</scalarParameterType> <dataSet>titles.names</dataSet> <column>TITLENAME</column> </parameter> </filter:layer> </config>
<!-- parameter examples --> <!-- a parameter representing a floating point value between 2.5 and 26 with an increment of 0.5 and default value of 13 --> <parameter id="level"> <label>Level (m)</label> <controlType>slider</controlType> <dataType>float</dataType> <column>Level_mGH</column> <minValue>2.5</minValue> <maxValue>26</maxValue> <value>13</value> <increment>0.5</increment> <decimalPrecision>1</decimalPrecision> </parameter> <!-- a parameter representing an integer value between 2011 and 2019 inclusive with a default minimum of 2015 and default maximum of 2018 --> <parameter id="study_year"> <label>Study Year</label> <controlType>multislider</controlType> <dataType>int</dataType> <column>Study_year</column> <minValue>2011</minValue> <maxValue>2019</maxValue> <leftValue>2015</leftValue> <rightValue>2018</rightValue> </parameter> <!-- multiple grouped check boxes. Note in this case all checked boxes start as checked but if none of the check boxes are checked all items would be displayed as well --> <parameter id="location"> <label>Location</label> <controlType>multicheck</controlType> <column>Location</column> <dataType>string</dataType> <list label="Catchment, Todd" value="Todd Catchment" checked="true"/> <list label="River, Adelaide" value="Adelaide River" checked="true"/> <list label="River, McArthur" value="McArthur River" checked="true"/> </parameter> <!-- single check box. Note in the case since we've set a different true value when this check box is checked the filter applied will be "Location='Adelaide River'" rather than "Location=true" as would be the case if trueValue were no set --> <parameter id="location"> <label>Adelaide River Only</label> <controlType>check</controlType> <column>Location</column> <dataType>string</dataType> <trueValue>Adelaide River</trueValue> </parameter> <!-- radio button --> <parameter id="location"> <label>Location</label> <controlType>radio</controlType> <column>Location</column> <dataType>string</dataType> <value>Adelaide River</value> <list label="Catchment, Todd" value="Todd Catchment"/> <list label="River, Adelaide" value="Adelaide River"/> <list label="River, McArthur" value="McArthur River"/> </parameter> <!-- list box --> <parameter id="location"> <label>Location</label> <controlType>list</controlType> <dataSet>locations</dataSet> <column>Location</column> <dataType>string</dataType> </parameter> <!-- a basic text box. Note this format is discuoraged as the user has no way of knowing if the value they're entering is valid and may result in nothing being displayed --> <parameter id="location"> <label>Location</label> <controlType>text</controlType> <column>Location</column> <dataType>string</dataType> </parameter>
Client
<client:config id="filtering"> <title>Example Filtering client</title> <!-- other config here --> <view id="weave.layerFilter"> <location>east</location> </view> <!-- other config here --> </client:config>