2020-07-15 12:08:27 +02:00
{
2020-10-04 09:23:09 +02:00
"name": "overlay_contains",
2020-07-15 12:08:27 +02:00
"type": "function",
2020-09-11 22:06:10 +02:00
"groups": ["GeometryGroup"],
2020-10-16 07:24:55 +02:00
"description": "Returns whether the current feature spatially contains at least one feature from a target layer, or an array of expression-based results for the features in the target layer contained in the current feature.<br><br>Read more on the underlying GEOS \"Contains\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Contains.html'>ST_Contains</a> function.",
2020-09-11 22:06:10 +02:00
"arguments": [
2020-07-15 12:08:27 +02:00
{
"arg": "layer",
2020-10-15 08:05:14 +02:00
"description": "the layer whose overlay is checked"
2020-07-15 12:08:27 +02:00
},
{
"arg": "expression",
2020-10-15 08:05:14 +02:00
"description": "an optional expression to evaluate on the features from the target layer. If not set, the function will just return a boolean indicating whether there is at least one match.",
2020-07-15 12:08:27 +02:00
"optional": true
},
{
"arg": "filter",
2020-10-15 08:05:14 +02:00
"description": "an optional expression to filter the target features to check. If not set, all the features will be checked.",
2020-07-15 12:08:27 +02:00
"optional": true
},
{
"arg": "limit",
2020-10-15 08:05:14 +02:00
"description": "an optional integer to limit the number of matching features. If not set, all the matching features will be returned.",
2020-07-15 12:08:27 +02:00
"optional": true
2020-09-08 18:11:07 +02:00
},
{
"arg": "cache",
"description": "set this to true to build a local spatial index (most of the time, this is unwanted, unless you are working with a particularly slow data provider)",
"optional": true,
2020-10-15 08:05:14 +02:00
"default": "false"
2020-07-15 12:08:27 +02:00
}
],
"examples": [
2020-08-20 14:07:18 +02:00
{
2020-10-04 09:23:09 +02:00
"expression": "overlay_contains('regions')",
2020-10-15 08:05:14 +02:00
"returns": "true if the current feature spatially contains a region"
},
{
"expression": "overlay_contains('regions', filter:= population > 10000)",
"returns": "true if the current feature spatially contains a region with a population greater than 10000"
2020-08-20 14:07:18 +02:00
},
2020-07-15 12:08:27 +02:00
{
2020-10-04 09:23:09 +02:00
"expression": "overlay_contains('regions', name)",
2020-10-15 08:05:14 +02:00
"returns": "an array of names, for the regions contained in the current feature"
2020-08-20 14:07:18 +02:00
},
2020-11-15 19:03:47 +01:00
{
"expression": "array_to_string(overlay_contains('regions', name))",
"returns": "a string as a comma separated list of names, for the regions contained in the current feature"
},
2020-08-20 14:07:18 +02:00
{
2020-10-15 08:05:14 +02:00
"expression": "array_sort(overlay_contains(layer:='regions', expression:=\"name\", filter:= population > 10000))",
"returns": "an ordered array of names, for the regions contained in the current feature and with a population greater than 10000"
2020-08-20 14:07:18 +02:00
},
{
2020-10-15 08:05:14 +02:00
"expression": "overlay_contains(layer:='regions', expression:= geom_to_wkt($geometry), limit:=2)",
"returns": "an array of geometries (in WKT), for up to two regions contained in the current feature"
2020-07-15 12:08:27 +02:00
}
]
}