containing
containing
filters a set of areas based on the objects they contain.
Context | Type |
---|---|
Input | set of areas |
Output | set of areas |
Examples
Set the status of areas with 'busy planes':
when
area().containing(tag="plane", avg[passengers]>6)
then
set("status", "high capacity planes on average")
Containing filters out any areas that do not contain any objects with the specified attributes. Just one object that matches the specified attributes will keep the area in the output set.
Notes
Containing treats the names of the attributes it filters on in a special way. If the attribute name uses one of the special aggregation functions, then the comparison works on the aggregated value of the attribute.
containing(tag="plane", avg[passengers]>6)
In this case, the filter finds all the objects with a 'tag' attribute of 'plane', and then averages the 'passengers' attribute of those objects. It then compares that average to 6. If the average is greater than 6, then the area is kept in the output set.
The special aggregation functions are:
- avg - the average of the values
- max - the maximum of the values
- min - the minimum of the values