I want to enable single feature selection using Python. I want to make a script in Python that will first enable single feature selection, and then it will return the id of selected feature. I have coded the second part, but how do I enable single feature selection?
layer = iface.activeLayer()
h = layer.selectedFeatures()
for f in h:
g = f['ID']
print g
-
What do you mean by single feature selection?underdark– underdark2017年04月16日 18:34:44 +00:00Commented Apr 16, 2017 at 18:34
1 Answer 1
What do you mean by single feature selection? The Select Feature(s) tool is single feature select if you just click and do not drag the cursor.
You can set the active tool with:
iface.actionSelect().trigger()
You can write your own selection tool like described here:
Explore related questions
See similar questions with these tags.