I am working from QGIS actions with python and want go to select the current feature that I've identified using the identify tool. (Key point is that there is a difference between identify and select). What do I need for my action to make the current feature selected?

I have used vlayer.setSelectedFeatures( [ ] ) but this so far hasn't allowed me to enter the current feature.

I've making use of previous posts to help me including:

Is it possible to take automatically a "screenshot" of my selected feature in QGIS using Python?

How to create a QGIS action which copies features between layers?

There is a little more to what I'm trying to achieve which is why I'm looking at actions. Firstly I don't just want to select the feature I want to Zoom to the feature. (I had sussed zooming to selected features). The beauty of actions is that they are available from an attribute table and what's more in a relation within custom forms. Hence I really wanted to achieve zooming to a feature using an action by right clicking on and attribute table. These other options aren't available here.

An automated select on identify May be a solution, I would be interested learn more but would have to look at it.

The key is it needs to be a simple process for the user.

  • Did you know you can select features from the identify results window by right clicking on any of the feature's attributes and selecting "Toggle feature selection"?
    – ndawson
    Feb 12, 2015 at 22:04
  • I've come up with a solution that doesn't involve QGIS actions. After identifying a feature on the map using the Identify tool, the feature is automatically selected. Would you be interested in that? Feb 13, 2015 at 13:40
  • @andrew-bell The solution I've talked about can also zoom in the selected feature. However, I'm getting lost with your question (requirements). If you cannot rephrase it in a way it denotes clearly what you want, I'm afraid I cannot help here. Feb 14, 2015 at 1:36


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.