Set a Vector input as a variable in QGIS Tool Script

المشرف العام

Administrator
طاقم الإدارة
In a QGIS script, how do you set a Vector input (via your tool's GUI) as a variable which can then be used in subsequent processing in your tool's script?

I know how to set a map Layer as a variable, for example:

pts = QgsMapLayerRegistry.instance().mapLayersByName('civic_pts')[0]But instead of hard-wiring my file inputs like that, I want the flexibility of setting my inputs via the tool's GUI.

I've tried:

##Input_civic_pts=vector...and then tried using it later in the script, for example...

for feat in Input_civic_pts.getFeatures():...but this generates an error.

The same script works fine when I hard-wire the civic_pts file as above.

Obviously I don't know how to convert an Input to a scripting variable.



أكثر...
 
أعلى