Skip to content
Permalink
Browse files

Merge pull request #40159 from DelazJ/isSelectedGetFeature316

Add/fix examples of is_selected function
  • Loading branch information
m-kuhn committed Nov 20, 2020
2 parents d01c9bd + 2f876bc commit cd54dd43fb5010cf47bbb35ea80b1a0a893f7dd1
@@ -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\""}]
}
@@ -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." }
]
}
]
}
@@ -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"
@@ -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",
@@ -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",
@@ -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",

0 comments on commit cd54dd4

Please sign in to comment.
You can’t perform that action at this time.