[Qgis-user] Access attributes of temp "layer" before loading into qgis

Wolfgang Meinolf wmeinolf at bbv-deutschland.de
Tue Sep 14 02:43:32 PDT 2021


Hi,
In my scripts I work intensively with processing algs. In the script the processing algs  “OUTPUT” is set to QgsProcessing.TEMPORARY_OUTPUT. The result is written to i.e. outputs [ResultFirststAlg]. When I like to feed the result in the next alg inside the same script, I set “INPUT” of the following alg to outputs [ResultFirststAlg] [OUTPUT]. So far so good.

Now, I like to change some attributes in the Layer, which is at outputs [ResultFirststAlg] [OUTPUT]. I can do this  with the field calculator, however the results are then stored in a new layer, i.e. outputs [FieldCalc] [OUTPUT].

Currently I load the layer into qgis by using loadlayer alg at the end of the first script. Then I start a new script, which address the layer via Layer = QgsProject.instance().mapLayersByName(‘Loaded Layer from first script’), calculate the index by LayerIndex = Layer [0] or the Name for algs as LayerName = LayerIndex.name().

Now, when I consolidate the scripts, I cannot select by layername, as the loadlayer seems to be processed at the end of the script.

Is there any way, to modify attribute values directly in the initial layer at  outputs [ResultFirststAlg] [OUTPUT]?

Thanks in advance
Wolfgang



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210914/1965c5bf/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3641 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20210914/1965c5bf/attachment.bin>


More information about the Qgis-user mailing list