ASSET_ROUTE(
ANY(),
INSIDE(LOC(),AREA(name="Brussels")),
ANY()
)
This article provides common examples of asset route filtering. Also refer to the Filtering introduction and Query language syntax articles.
ASSET_ROUTE(
ANY(),
INSIDE(LOC(),AREA(name="Brussels")),
ANY()
)
This filter will show all the records of the assets that pass through the Brussels area.
It won’t show the assets that have only records inside the Brussels area. If you want to include those as well, you need to make the any leg optional:
ASSET_ROUTE(
ANY(mandatory=false),
INSIDE(LOC(), AREA(name="Brussels")),
ANY(mandatory=false)
)
If you want all the records of the assets that start outside Brussels, then go through Brussels, and then end outside of Brussels, you need to specify this additionally. Hence, the filter to only get drive-through traffic is:
ASSET_ROUTE(
NOT(INSIDE(LOC(), AREA(name="Brussels"))),
ANY(mandatory=false),
INSIDE(LOC(), AREA(name="Brussels")),
ANY(mandatory=false),
NOT(INSIDE(LOC(), AREA(name="Brussels")))
)
You can also combine it with other filters, for example to limit it to assets that travelled at a certain speed through the Brussels area:
ASSET_ROUTE(
NOT(INSIDE(LOC(), AREA(name="Brussels"))),
ANY(mandatory=false),
AND(
INSIDE(LOC(), AREA(name="Brussels")),
BETWEEN(PROP("speed"), 40,70)
),
ANY(mandatory=false),
NOT(INSIDE(LOC(), AREA(name="Brussels")))
)
ASSET_ROUTE(
AND(
START(),
NOT(INSIDE(LOC(), AREA(name="Brussels")))
),
NOT(INSIDE(LOC(), AREA(name="Brussels"))),
AND(
END(),
NOT(INSIDE(LOC(), AREA(name="Brussels")))
)
)
Saying that an asset does not pass through an area is the equivalent of saying that:
The start point of the asset is located outside that area
The end point of the asset is located outside that area
And all points in between are also located outside that area
And that is what this filter expresses.
ASSET_ROUTE(
INSIDE(LOC(), AREA(name="Brussels")),
ANY(),
INSIDE(LOC(), AREA(name="Leuven"))
)
This filter shows all the assets that travel from Brussels to Leuven. It does not show the whole trajectory of the asset, but only the part starting in Brussels and ending in Leuven.
This will also include assets that started before Brussels and/or continue after Leuven. For example an asset that travels from Oostende to Brussels to Leuven to Luik will be included in this filter. However, the only part that is shown is the Brussels to Leuven part. The Oostende to Brussels and Leuven to Luik part are discarded by the filter.
If you want to include those parts (=showing the whole trajectory of the asset), you need to add optional any legs to the filter:
ASSET_ROUTE(
ANY(mandatory=false),
INSIDE(LOC(), AREA(name="Brussels")),
ANY(),
INSIDE(LOC(), AREA(name="Leuven")),
ANY(mandatory=false)
)
If you only want to see assets that started in Brussels and ended in Leuven, you need to say that the start/end location of the asset is located in the area instead of any location of the asset:
ASSET_ROUTE(
AND(
START(),
INSIDE(LOC(), AREA(name="Brussels"))
),
ANY(),
AND(
END(),
INSIDE(LOC(), AREA(name="Leuven"))
)
)
ASSET_ROUTE(
INSIDE(LOC(), AREA(name="Brussels")),
ANY()
)
For each asset that has records in Brussels, the filter will retain the records in Brussels and all records that happen later in time. This will show you where the traffic from the Brussels region is going to.
This doesn’t necessarily mean that the asset started in the Brussels area. If you want to limit it to those, you need to use
ASSET_ROUTE(
AND(
START(),
INSIDE(LOC(), AREA(name="Brussels"))
),
ANY()
)
Now the filter only matches assets that start in Brussels.
If you’re only interested in assets that start at a specific time, you can add a condition to the filter:
ASSET_ROUTE(
AND(
START(),
INSIDE(LOC(), AREA(name="Brussels")),
BETWEEN(HOUR(TIME(), timezone="Europe/Brussels"), 8, 9)
),
ANY()
)
This will limit it to assets that start in Brussels between 8:00 and 09:59 AM in the Brussels timezone.
ASSET_ROUTE(
ANY(),
INSIDE(LOC(), AREA(name="Brussels"))
)
For each asset that has records in Brussels, the filter will retain the records in Brussels and all records that happened earlier in time. This will show you where the traffic in the Brussels region is coming from.
This doesn’t necessarily mean that the asset ended in the Brussels area. If you want to limit it to those, you need to use
ASSET_ROUTE(
ANY(),
AND(
END(),
INSIDE(LOC(), AREA(name="Brussels"))
)
)
Now the filter only matches assets that arrive in Brussels.
If you’re only interested in assets that arrive at a specific time, you can add a condition to the filter:
ASSET_ROUTE(
ANY(),
AND(
END(),
INSIDE(LOC(), AREA(name="Brussels")),
BETWEEN(HOUR(TIME()), 8, 9)
)
)
This will limit it to assets that arrive in Brussels between 8:00 and 09:59 AM (in UTC as there is no timezone specified).
The following filter will show all the traffic from Oostende to Luik which passes through Brussels and Leuven:
ASSET_ROUTE(
INSIDE(LOC(), AREA(name="Oostende")),
ANY(),
INSIDE(LOC(), AREA(name="Brussels")),
ANY(),
INSIDE(LOC(), AREA(name="Leuven")),
ANY(),
INSIDE(LOC(), AREA(name="Luik"))
)
The following filter will show all the traffic from Oostende to Luik which doesn’t pass through Brussels nor Leuven:
ASSET_ROUTE(
INSIDE(LOC(), AREA(name="Oostende")),
AND(
NOT(INSIDE(LOC(), AREA(name="Brussels"))),
NOT(INSIDE(LOC(), AREA(name="Leuven")))
),
INSIDE(LOC(), AREA(name="Luik"))
)
The following filter will show all the traffic from Oostende to Luik that:
Either travels through Brussels and Leuven, or
Travels through Ghent and Antwerp
ASSET_ROUTE(
INSIDE(LOC(), AREA(name="Oostende")),
ANY(),
SWITCH_LEG(
LINEAR_LEG(INSIDE(LOC(), AREA(name="Brussels")), ANY(),INSIDE(LOC(), AREA(name="Leuven"))),
LINEAR_LEG(INSIDE(LOC(), AREA(name="Ghent")), ANY(),INSIDE(LOC(), AREA(name="Antwerp")))
),
ANY(),
INSIDE(LOC(), AREA(name="Luik"))
)