I am trying to get the field index of a layer that is input using add vector parameter
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 this with the path-
vlayer = QgsVectorLayer('C:\Elevationpoints.shp')
index = vlayer.fields().lookupField('Lidar')
print(index)
By if I try to use the layer ID from the console or the script GUI I get -1 meaning the field was not found.
How can I get the field index from the layer ID?