Skip to content

Commit

Permalink
Various tweaks to the overlay_contains function description and examples
Browse files Browse the repository at this point in the history
  • Loading branch information
DelazJ authored and nyalldawson committed Oct 15, 2020
1 parent 748aa4c commit cb37b18
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions resources/function_help/json/overlay_contains
Expand Up @@ -2,50 +2,54 @@
"name": "overlay_contains",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Performs a spatial join of type CONTAINS. This returns an array of results of an expression evaluated on features from a different layer that CONTAINS the current feature, or, if no expression if provided, simply returns whether at least one feature from the other layer CONTAINS the current feature.",
"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.",
"arguments": [
{
"arg": "layer",
"description": "the other layer"
"description": "the layer whose overlay is checked"
},
{
"arg": "expression",
"description": "an optional expression to evaluate on the features from the other layer (if not set, the function will just return a boolean indicating whether there is at least one match)",
"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.",
"optional": true
},
{
"arg": "filter",
"description": "an optional expression to filter the matching features (if not set, all features will be returned)",
"description": "an optional expression to filter the target features to check. If not set, all the features will be checked.",
"optional": true
},
{
"arg": "limit",
"description": "an optional integer to limit the number of matching features (if not set, all features will be returned)",
"description": "an optional integer to limit the number of matching features. If not set, all the matching features will be returned.",
"optional": true
},
{
"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,
"default": false
"default": "false"
}
],
"examples": [
{
"expression": "overlay_contains('regions')",
"returns": "True"
"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"
},
{
"expression": "overlay_contains('regions', name)",
"returns": "['South Africa', 'Africa', 'World']"
"returns": "an array of names, for the regions contained in the current feature"
},
{
"expression": "overlay_contains('regions', name, name != 'World')",
"returns": "['South Africa', 'Africa']"
"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"
},
{
"expression": "overlay_contains('regions', name, limit:=1)",
"returns": "['South Africa']"
"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"
}
]
}

0 comments on commit cb37b18

Please sign in to comment.