[QGIS-Developer] Geometry in Python Layer Action

Peter Devoy peter at 3xe.co.uk
Wed Dec 12 08:41:56 PST 2018


Hi list

I hope questions for 2.X are still OK as I am using 2.18...

If I want to get the geometry of a selected feature on the current
layer I can do:

iface.mapCanvas().currentLayer().selectedFeatures()[0].geometry()

In a Python layer action (defined in Layer Properties dialog), is
there a similar way to get the geometry of the feature that the user
interacted with to trigger the action?  E.g. something like:

signalSourceFeature.geometry()

Thanks


Peter D


More information about the QGIS-Developer mailing list