The filter style allows you to render only certain features from your feature layer that meet all of the filter conditions. A filter style can be configured to have one or more filter conditions. Each filter condition has a column name, match type and match value. The column name specifies which column of the attribute data you want to filter on. The match type and match value allow you to set up the operator and criteria for the filter condition.
Filter styles can be extremely useful in scenarios where you only want to render certain features that meet several criteria. For example let's say you have a feature layer that contains all of the restaurants in your city and you want to build a map that shows all of the Chinese restaurants that have a rating greater than seven. You could easily do this by utilizing a filter style with two filter conditions. The first filter condition would be based on the restaurant type where it equals Chinese Food. The second filter condition would be based on the rating column where the value was greater than seven.
Name - Name of the filter style.
To add filter conditions just click on the Add New button.
Column Names - This drop down allows you to pick the column you want to base your filter condition on. You can click the view data button to see the available columns and data on your feature layer.
Match Type - This drop down sets the type of operation you want to use on the filter condition. For example if you had a column named rating that contained values from 1 to 10, you could use a match type of GreaterThan and a match value of 7 to return all features that had a rating greater than 7 in the attribute data. If custom is chosen for a match type, then you must put a valid regular expression in the match value text box to have a valid filter condition.
Examples of Match Types | Description |
---|---|
DoesNotContain | Applies style to all features that does not contain the Match Value. |
DoesNotEqual | Applies style to all features that does not match the Match Value. |
Contains | Applies style to all features that contain the Match Value. |
Equal | Applies style to all features that exactly match the Match Value. |
StartsWith | Applies style to all features that start with the same characters as the Match Value. |
EndsWith | Applies style to all features that end with the same characters as the Match Value. |
GreaterThan | Applies style to all features that are equal to or greater than the numeric Match Value. |
GreaterThan | Applies style to all features that are greater than the numeric Match Value. |
LessThanOrEqualTo | Applies style to all features that are equal to or less than the numeric Match Value. |
LessThan | Applies style to all features that are less than the numeric Match Value. |
DateRange | Applies style to all features that fall between two dates. |
NumericRange | Applies style to all features that fall between two numbers. |
IsEmpty | Applies style to all features that do not have a value. |
IsNotEmpty | Applies style to all features that has any value. |
ValidFeature=Valid | Applies style to all features that has valid geometry. |
ValidFeature=Invalid | Applies style to all features that has invalid geometry. |
Custom (Regex) | Applies style to all features that matches a valid regular expression. |
Match Value - This is where you set the value you wish to base your filter condition on. If match type is set to custom then this text box must be set to a valid regular expression in order to be a valid filter condition.
In addition to setting up conditions, there is also a Script Tab that allows you to filter your features in a more custom manner. The script languages available to use are Python, CSharp, and Ruby. If you are unsure of how to start with your script, there is an Import code sample button on the bottom of the scripting block to give you an idea on where to start. Before you apply the filter using scripting, it is best to use Test Script to insure your script is running properly.