Hi, I am trying to create a tool that chains together some algorithms. Normally I would just use the graphical modeler but one of the tools I want to chain together is Tin Interpolation that doesn't seem to work well with the modeler. I have gotten it to work by setting up what I can in the modeler and then exporting and modifying a python script. One thing that I can't seem to get to work is the input field for the interpolation plugin. It appears to need the field index. I can get the field index if I have the file path but when I use the Vector Layer Parameter like this: *self.addParameter(QgsProcessingParameterVectorLayer('Elevationpoints', 'Elevation_points', types=[QgsProcessing.TypeVectorAnyGeometry], defaultValue=None))*
This seems to return the layer ID rather than the path. Something like this: *'Elevationpoints_ad0ce945_8f93_4e0e_8fe7_5b053ef287dd'* In the console I get the correct result if I run script this with the path- *vlayer = QgsVectorLayer('C:\Elevationpoints.shp')index = vlayer.fields().lookupField('Lidar')print(index)* But if I try to use the layer ID from the console or the script GUI I get -1 meaning the field was not found. And if I run dataprovider() it says the layer doesn't have a data provider. How can I get the field index from the layer ID? I also posted this question on stack exchange. https://gis.stackexchange.com/questions/379502/index-of-field-layer-where-i-have-the-layer-id-pyqgis-3 Thanks for the help! -Bas
_______________________________________________ Qgis-user mailing list Qgis-user@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user