In the past with QGIS I was able to autofill layer names into file names when doing a batch export. Trying this now though, the autofill doesn't bring in the layer name. I'm using the Windows version of 3.38.1, when I set up my file name I add a prefix and underscore, I tell the autofill to use the Layer Name as the parameter, however, the paths just show the prefix in the file name and running the process causes the exports to overwrite each other so only the last run export is all that is in the results folder.
When I try to autofill by expression the @Input variable works, but adds a random string to the end of each layer's name. Using the @LayerName acts like the layer name parameter, nothing gets appended to the end of my provided string.
It has been a while since I've tried this, was there a change to the setup process? I've check the documentation and some recent tutorial versions and I'm not seeing any changes to the old procedure.
1 Answer 1
Two suggestions for managing this:
1st method: Use the Calculate by Expression to build the output filename. The screenshots show the result with a batch clip operation. Same logic can be used with other batch operations. enter image description here The layers below will be filled automatically: enter image description here
2nd method: First set an output file for the 1st layer. The screenshots show the result with a batch clip operation:
Set the output file for the 1st Layer: set output file
Next, select the options shown here:
Result:
-
The 2nd method is what I was trying, and I'm not sure what I was missing but I got it now, thank you! For the 1st method, I did get that to work yesterday but @INPUT was appending an underscore and a long string of random characters. In your example, is the file_name function stripping those characters off?HeyOverThere– HeyOverThere2024年08月20日 14:07:33 +00:00Commented Aug 20, 2024 at 14:07
-
Yes - in the 1st method, the random characters are not generated as part of the layername. I think the random characters relate to temporary files.Aquamarine– Aquamarine2024年08月20日 14:30:16 +00:00Commented Aug 20, 2024 at 14:30