Skip to content
Permalink
Browse files

Add/fix examples using the get_feature_by_id function

  • Loading branch information
DelazJ authored and nyalldawson committed Nov 15, 2020
1 parent 10ab25e commit 6ee681a22488c992be42f34cc351fde4ec1b919e
Showing with 8 additions and 4 deletions.
  1. +1 −1 resources/function_help/json/get_feature_by_id
  2. +7 −3 resources/function_help/json/is_selected
@@ -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,17 @@
"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 the current atlas feature is selected." },
{ "expression": "is_selected(get_feature_by_id('streets', 1))", "returns": "True if the feature with the id 1 on the active \"streets\" 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')." },
{ "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." }
]
}
]
}

0 comments on commit 6ee681a

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