2

I need to show point coordinates on the from dialog used to edit the attributes of a point.. I see that in the formOpen the dialog receives a layerId and a featureId, but no iface object, so how can get a provider to use the selectatId() and reach feature informations?

def formOpen(dialog,layerid,featureid):
...omissis...

(see here for a more detailed explanation of custom qgis forms)

  • What version of QGIS? – Nathan W Dec 7 '13 at 2:50
1

never mind. I was fooled by the function declaration used in the example. Actually, it should be:

def formOpen(dialog,layer,feature):
    ...omissis...
    geometry = feature.geometry()
    wktString = geometry.exportToWkt()

That is: the function is receiving the ACTUAL object, not it's id. So I can access the geometry by direct function call.

  • 2
    My blog post if pre 2.0 which used to only get pasted the feature id. Now it gets passed the whole object. – Nathan W Dec 7 '13 at 13:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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