I currently want to intersect every line from a Linestring layer with another Linestring layer that I get from a WFS. When I use the GUI to do that (Vector -> Analysis tools -> Line Intersections...) it works perfectly. Yet I am trying to do that using the Python Console inside QGIS3 with the following function:
def loadIntersections():
player = QgsVectorLayer('Point?crs=EPSG:4326', 'linhas selecionadas', 'memory')
provider = player.dataProvider()
provider.addAttributes([QgsField('name', QVariant.String)])
player.updateFields()
QgsProject.instance().addMapLayer(player)
intersect_layer = QgsProject.instance().mapLayersByName('linhas_stpc')[0]
processing.run('qgis:lineintersections', 'pontos_selecionados', 'linhas_stpc','memory:pontos')
Yet I get the following error:
TypeError: QgsProcessingAlgorithm.checkParameterValues(): argument 1 has unexpected type 'str'
I must note that I have tried to load the layers into alias using the QgsProject.instance().mapLayersByName($LAYER_NAME)[0] but then the unexpected parameter changes from 'str' to 'QgsVectorLayer'. It is worth noticing that in the processing algorithm documentation both types are acceptable.
I only need to replicate the function used by the GUI to a script.