Class MBFilter
This wrapper class is used by MBObjectParser to generate rule filters when
transforming MBStyle.
This wrapper and MBFunction are a matched set handling data expression.
Data expression: Decision
Implementation Note: The value for any filter may be specified as an data expression. The result type of an data expression in
the filter property must be boolean. See MBExpression for details.
The expressions in this section can be used to add conditional logic to your styles. For example, the 'case' expression provides "if/then/else" logic, and 'match' allows you to map specific values of an input expression to different output expressions.
["!", boolean]: boolean["!=", value, value]: boolean</code><===>>=allanycasecoalescematchwithin
Filter Other
Implementation Note: GeoTools also supports the depreciated syntax documented here (provided by a previous versions of the Mapbox style specification).
A filter selects specific features from a layer. A filter is an array of one of the following forms:
Existential Filters
["has", key]- feature[key] exists["!has", key]- feature[key] does not exist
Comparison Filters:
- ["==", key, value] equality: feature[key] = value
- ["!=", key, value] inequality: feature[key] ≠ value
- [">", key, value] greater than: feature[key] > value
- [">=", key, value] greater than or equal: feature[key] ≥ value
- ["<", key, value] less than: feature[key] < value
- ["<=", key, value] less than or equal: feature[key] ≤ value
Set Membership Filters:
- ["in", key, v0, ..., vn] set inclusion: feature[key] ∈ {v0, ..., vn}
- ["!in", key, v0, ..., vn] set exclusion: feature[key] ∉ {v0, ..., vn}
Combining Filters:
- ["all", f0, ..., fn] logical AND: f0 ∧ ... ∧ fn
- ["any", f0, ..., fn] logical OR: f0 ∨ ... ∨ fn
- ["none", f0, ..., fn] logical NOR: ¬f0 ∧ ... ∧ ¬fn
A key must be a string that identifies a feature property, or one of the following special keys:
- "$type": the feature type. This key may be used with the "==", "!=", "in", and "!in" operators. Possible values are "Point", "LineString", and "Polygon".
- "$id": the feature identifier. This key may be used with the "==", "!=", "has", "!has", "in", and "!in" operators.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final FilterFactoryprotected final JSONArrayWrapped jsonprotected final MBObjectParserParser context.protected final SemanticTypeDefault semanticType (or null for "geometry").static final Stringstatic final Stringstatic final String -
Constructor Summary
ConstructorsConstructorDescriptionMBFilter(JSONArray json) MBFilter(JSONArray json, MBObjectParser parse) MBFilter(JSONArray json, MBObjectParser parse, SemanticType semanticType) -
Method Summary
-
Field Details
-
TYPE_POINT
- See Also:
-
TYPE_LINE
- See Also:
-
TYPE_POLYGON
- See Also:
-
semanticType
Default semanticType (or null for "geometry"). -
parse
Parser context. -
ff
-
json
protected final JSONArray jsonWrapped json
-
-
Constructor Details
-
MBFilter
public MBFilter(JSONArray json) -
MBFilter
-
MBFilter
-
-
Method Details
-
semanticTypeIdentifiers
Translate "$type": the feature type we need This key may be used with the "==", "!=", "in", and "!in" operators. Possible values are "Point", "LineString", and "Polygon".- Returns:
- Set of GeoTools SemanticType (Point, LineString, Polygon).
-
filter
Generate GeoToolsFilterfrom json definition.This filter specifying conditions on source features. Only features that match the filter are displayed.
- Returns:
- GeoTools
Filterspecifying conditions on source features.
-