In **FLOW**, set operators allow you to handle selected trajectories as sets and perform the corresponding operations on them.

Let's say you connect outputs of two operators to the input of another. We'll name their outputs A, B, and C respectively.

As a basic rule, all FLOW operators create a union of their input trajectory sets (A ∪ B) before applying their operations. This is true even for speed filters etc. The only exception is the intersection operator, as is explained further.

The explicit **Union **operation simply outputs a union of its input sets, i.e. C = A ∪ B. It comes in handy e.g. as the last element of an analytic that you want to attach a **widget** or a **sink** too.

The **Complement **operation finds a complement of the input set relative to the set of all existing trajectories. If there are more sets at the input, it first creates their union: C = (A ∪ B)'.

The **Intersection **operation, as mentioned earlier, doesn't create a union of its input sets. It directly finds their intersection: C = A ∩ B.

To use the output of a set operation further, connect its bottom connector to another operator, just like with other operators.

## Set operators and zone filter masks

As mentioned in the **spatial filters article**, zone filters create masks that consider only the parts of trajectories that are inside the zones. Now, what happens if multiple zone filters are connected to the input of a set operator?

All operators create a union of all masks that are at their input. For the sake of discussion about particular set operators, let’s consider an example where two-zone filters are connected to the input of a set operator.

If it’s a union operator, it selects all trajectories that cross at least one of the zones and masks them by the area of both zones.

The complement operator selects trajectories that don’t cross any of the zones. Masking isn’t relevant here.

The intersection operator selects trajectories that cross both zones and masks them by the area of both zones.

## What next?

Find out how to visualize information about filtered trajectories with

**widgets**.Find out how to use

**FLOW’s REST API**and receive trajectory data in real-time into your own devices with sinks.

**Want to learn more? Contact us!**