<html><head></head><body><div class="ydpe893b85yahoo-style-wrap" style="font-family:Helvetica Neue, Helvetica, Arial, sans-serif;font-size:13px;"><div><div dir="ltr" data-setdir="false">Hi André, Is it possible to refer to a list of layers in the project, or does your code run without the QGIS project being opened?</div><div dir="ltr" data-setdir="false">Because, theoretically<span></span>, you need to point the layer or feature class you will use to extract the selected items, and in this case, you can save the name in a separate variable to use lately  to create a name for the output.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">I hope I helped.</div><div><br></div><div class="ydpe893b85signature"><div><span style="font-weight:bold;">José Roberto Ribeiro Filho</span> <span style="font-weight:bold;">- Geógrafo</span></div></div></div><div><br></div>
        
        </div><div id="yahoo_quoted_3847859551" class="yahoo_quoted">
            <div style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
                
                <div>
                        Em terça-feira, 3 de dezembro de 2024 às 13:24:42 BRT, Andre Kotze via QGIS-User <qgis-user@lists.osgeo.org> escreveu:
                    </div>
                    <div><br></div>
                    <div><br></div>
                
                
                <div><div id="yiv6574415172"><div>
<p>Dear all,</p>
<p>I have a processing algorithm that names its output based on the input layer's name, e.g. if buffering a layer called 'powerlines_110kW' with 40m the output layer would be called 'powerlines_110kW+40m'. For the input I use QgsProcessingParameterFeatureSource (instead of VectorLayer), so that the "Selected features only" option is available.</p>
<p>My problem is, when "Selected features" is unchecked, I can get the input layer's name with the 'parameterAsVectorLayer(parameters, 'INPUT', context).name()' method. However, when "Selected features" is checked, 'parameterAsVectorLayer()' returns None. This makes sense, as I believe the input becomes wrapped in a QgsProcessingFeatureSourceDefinition. Is there any way to get the layer's name before the selected features are extracted/filtered from the selected vector layer (the one given by the user in the ComboBox)?</p>
<p>Many thanks<br>André</p>

</div>
</div>_______________________________________________<br>QGIS-User mailing list<br><a ymailto="mailto:QGIS-User@lists.osgeo.org" href="mailto:QGIS-User@lists.osgeo.org">QGIS-User@lists.osgeo.org</a><br>List info: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br>Unsubscribe: <a href="https://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">https://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></div>
            </div>
        </div></body></html>