3

I am looking for a way to activate the "draw linestring" button with PyQGIS.

I had a look at this documentation:

https://qgis.org/pyqgis/3.2/gui/other/QgisInterface.html

But I can't find the right action:

    iface.layerTreeView().setCurrentLayer(layer)

    layer.startEditing()

    iface.name_of_the_draw_linestring_action_here().trigger()

1 Answer 1

5

There is not a specific action for "draw linestring" but rather one to add feature, regardless of the geometry:

iface.actionAddFeature().trigger()
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.