Wednesday, 28 November 2018

pyqgis - Changing layer name of output vector from processing script in QGIS?


I define an input csv file and an output like so in my processing script:


##Input_CSV_File=file
##Output_Shapefile=output vector

The output shapefile is added to the map automatically when the script is done, but the name of the layer in QGIS is always "Output Shapefile". I want to name the layer based on something in the file. Is there a way to change the name the layer is added with after the script is done?



Answer




Processing offers two approaches:



  • using the file name or

  • using the output name specified in the scripts.


You can change the behavior in the Processing options:


enter image description here


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...