1

i have loaded the layers in qgis from database. so after picking "toggle editing" plugin,the other corresponding plugin are in disabled state only,they are not enabled.how to set "add feature" plugin enabled using pyqgis.

1 Answer 1

3

Try the following code

# Find the layer to edit
layer = qgis.utils.iface.activeLayer()
layer.startEditing()
# Implement the Add Feature button
qgis.utils.iface.actionAddFeature().trigger()

Then add the features you wish to add to the layer.

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.