Within node
Description
The Within node takes two geographic inputs. It filters the items in your query by checking if the first area falls completely within the second area.
Usage
The Within node is a condition, so it can be added to the query branch directly after the root node or a logical node.
It can be populated with these nodes:
- Attribute (of Geometry type)
- GeoJSON
- Value From Item Attribute (of Geometry type)
Configuration
-
Swap - change the comparison node. If any segments hold values, they'll remain but the node types offered will be limited.
-
Delete - remove the node from the query.
-
Link negated - enable this to invert the condition imposed by the node. Items must now fail the condition to be included in the query results.
Example
Fetch all bollards within this area
In full detail:
Fetch items of the Bollards interface where their Geometry attribute falls completely within the defined area
To see this example built step-by-step, see Example 2 - Geographic.
See JSON code
This code may reference designs, interfaces, attributes or items that don't exist in your Alloy database.
{
"type": "Query",
"properties": {
"collectionCode": "Live",
"dodiCode": "designs_bollards"
},
"children": [
{
"type": "GeomWithin",
"children": [
{
"type": "Attribute",
"properties": {
"attributeCode": "attributes_itemsGeometry"
}
},
{
"type": "Geometry",
"properties": {
"value": {
"type": "Polygon",
"coordinates": [
[
[-1.528451, 52.291276],
[-1.532371, 52.290544],
[-1.535095, 52.288647],
[-1.534088, 52.28752],
[-1.527428, 52.290062],
[-1.528451, 52.291276]
]
]
}
}
}
]
}
]
}