[Qgis-developer] Geometry of feature in python while digitizing

Marco Bernasocchi marco at bernawebdesign.ch
Fri May 11 14:53:48 PDT 2012


Hi all, I'm trying to make a custom form that can make some calculations 
on poligons when a button on it is pushed. For this I wrote a python 
script like explained by Nathan at [0].

All works when the form is opened by an action in the identify tool, but 
when the form is openend because the digitalization of the polygon is 
finished (right click) the form allways gets a featureID of 0 (using 
identify the ID varies).

So my problem is that I can't get to the geometry of the polygon just 
digitized. I allways get the geometry of feature 0.

My simplyfied function looks like this:

def openForm(dialog,layerID,featureID):
	msgBox = QMessageBox()
   	msgBox.setText("ID: " + str(featureID) )
  	msgBox.exec_()

any hints?
Thanks a lot
MArco


[0] 
http://woostuff.wordpress.com/2011/09/05/qgis-tips-custom-feature-forms-with-python-logic/
-- 
Marco Bernasocchi
www.opengis.ch


More information about the Qgis-developer mailing list