I have a process which I wish to automize with a Python Script. This Python Script accepts 2 input layers (1 point layer and 1 line layer; both layers do not have the same CRS). The script should then calculate the nearest line to each point.
My solution for this includes 3 steps:
1st step: reproject input layer (the line layer to be exact) with the processing algorithm "qgis:reprojectlayer" (in order to have two inputlayers with the same CRS)
2nd step: Calculation of the nearest lines to each point with the NNJoin plugin
3rd step: Transfer attribut with the field calculator
Before I started writing the Python script, I opened the Python console to test the commands I would need. First of all, I tried to test the qgis:reprojectlayer algorithm (for that, I did a "import processing"). And then, I checked the processing history and copied the usage of the algorithm into the console (I have run the algorithm before in order to do that).
And here is the problem: If I run this algorithm from the toolbox, it generates a output file which is instantly loaded into qgis. The same happens if I run the algorithm directly in the history window (with a doubleclick). But whenever I copy the functioncall (from the history) into my python console and run the command, it looks like this:
It says OUTPUT: memory:, but it does not load anything into qgis and I have also tried it with a different output-file-path but the output folder remains empty. It looks like the algorithm does not generate a file? And how can I assign the output file (which should be generated by the reprojectlayer-algorithm) to a variable within my python script?
My Python Script looks like this at the moment (I defined the inputs and output):
Any suggestions?