Skip to content

Commit

Permalink
Merge pull request #40159 from DelazJ/isSelectedGetFeature316
Browse files Browse the repository at this point in the history
Add/fix examples of is_selected function
  • Loading branch information
m-kuhn committed Nov 20, 2020
2 parents d01c9bd + 2f876bc commit cd54dd4
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion resources/function_help/json/get_feature_by_id
Expand Up @@ -5,5 +5,5 @@
"description": "Returns the feature with an id on a layer.",
"arguments": [ {"arg":"layer","description":"layer, layer name or layer id"},
{"arg":"feature_id","description":"the id of the feature which should be returned"}],
"examples": [ { "expression":"get_feature('streets', 1)", "returns":"the feature with the id 1 on the layer \"streets\""}]
"examples": [ { "expression":"get_feature_by_id('streets', 1)", "returns":"the feature with the id 1 on the layer \"streets\""}]
}
11 changes: 8 additions & 3 deletions resources/function_help/json/is_selected
Expand Up @@ -14,13 +14,18 @@
"variant": "One 'feature' parameter",
"variant_description": "If called with a 'feature' parameter only, the function returns true if the specified feature from the current layer is selected.",
"arguments": [ { "arg": "feature", "description": "The feature which should be checked for selection." } ],
"examples": [ { "expression": "is_selected(@atlas_feature)", "returns": "True if the current atlas feature is selected." } ]
"examples": [ { "expression": "is_selected(@atlas_feature)", "returns": "True if a selected feature on the current layer is the active atlas feature." },
{ "expression": "is_selected(get_feature(@layer, 'name', 'Main St.')))", "returns": "True if the unique named \"Main St.\" feature on the current layer is selected." },
{ "expression": "is_selected(get_feature_by_id(@layer, 1))", "returns": "True if the feature with the id 1 on the current layer is selected." }
]
},
{
"variant" : "Two parameters",
"variant_description": "If the function is called with both a layer and a feature, it will return true if the specified feature from the specified layer is selected.",
"arguments": [ { "arg": "layer", "description": "The layer (or its ID or name) on which the selection will be checked." }, { "arg": "feature", "description": "The feature which should be checked for selection." } ],
"examples": [ { "expression": "is_selected( 'streets', get_feature('streets', 'name', \"street_name\"))", "returns": "True if the current building's street is selected (assuming the building layer has a field named 'street_name' and the 'streets' layer has a field called 'name')." } ]
"arguments": [ { "arg": "layer", "description": "The layer (its ID or name) on which the selection will be checked." }, { "arg": "feature", "description": "The feature which should be checked for selection." } ],
"examples": [ { "expression": "is_selected( 'streets', get_feature('streets', 'name', \"street_name\"))", "returns": "True if the current building's street is selected (assuming the building layer has a field named 'street_name' and the 'streets' layer has a field called 'name' with unique values)." },
{ "expression": "is_selected( 'streets', get_feature_by_id('streets', 1))", "returns": "True if the feature with the id 1 on the \"streets\" layer is selected." }
]
}
]
}
4 changes: 4 additions & 0 deletions resources/function_help/json/overlay_contains
Expand Up @@ -47,6 +47,10 @@
"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"
},
{
"expression": "array_length(overlay_contains('regions', name))",
"returns": "the number of regions contained in the current feature"
},
{
"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"
Expand Down
2 changes: 1 addition & 1 deletion resources/function_help/json/overlay_intersects
Expand Up @@ -2,7 +2,7 @@
"name": "overlay_intersects",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Returns whether the current feature spatially intersects at least one feature from a target layer, or an array of expression-based results for the features in the target layer intersected by the current feature.<br><br>Read more on the underlying GEOS \"Intersects\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Intersects.html'>ST_INTERSECTS</a> function.",
"description": "Returns whether the current feature spatially intersects at least one feature from a target layer, or an array of expression-based results for the features in the target layer intersected by the current feature.<br><br>Read more on the underlying GEOS \"Intersects\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Intersects.html'>ST_Intersects</a> function.",
"arguments": [
{
"arg": "layer",
Expand Down
2 changes: 1 addition & 1 deletion resources/function_help/json/overlay_touches
Expand Up @@ -2,7 +2,7 @@
"name": "overlay_touches",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Returns whether the current feature spatially touches at least one feature from a target layer, or an array of expression-based results for the features in the target layer touched by the current feature.<br><br>Read more on the underlying GEOS \"Touches\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Touches.html'>ST_TOUCHES</a> function.",
"description": "Returns whether the current feature spatially touches at least one feature from a target layer, or an array of expression-based results for the features in the target layer touched by the current feature.<br><br>Read more on the underlying GEOS \"Touches\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Touches.html'>ST_Touches</a> function.",
"arguments": [
{
"arg": "layer",
Expand Down
2 changes: 1 addition & 1 deletion resources/function_help/json/overlay_within
Expand Up @@ -2,7 +2,7 @@
"name": "overlay_within",
"type": "function",
"groups": ["GeometryGroup"],
"description": "Returns whether the current feature is spatially within at least one feature from a target layer, or an array of expression-based results for the features in the target layer that contain the current feature.<br><br>Read more on the underlying GEOS \"Within\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Within.html'>ST_WITHIN</a> function.",
"description": "Returns whether the current feature is spatially within at least one feature from a target layer, or an array of expression-based results for the features in the target layer that contain the current feature.<br><br>Read more on the underlying GEOS \"Within\" predicate, as described in PostGIS <a href='https://postgis.net/docs/ST_Within.html'>ST_Within</a> function.",
"arguments": [
{
"arg": "layer",
Expand Down

0 comments on commit cd54dd4

Please sign in to comment.