I'm working with QGIS 3.2 Bonn and try to set up a workflow with the graphic modeler.
The model uses the Intersection Tool from the QGIS Geoprocessing Tools. The model works, but I don't want to keep all fields from the intersection process.
In this case, the tool provides the possibility to set "Input fields to keep" from the input feature layer and "Intersect fields to keep" from the intersect feature layer. I was able to define just one field to keep, but in case of several fields to keep in the output, I couldn't find any solution yet.
I tried different syntax possibilities:
- [attributefield1, attributefield2, ...]
- ["attributfield1", "attributefield2",...]
- "attributefield1", "attributefield2", ...
- 'attributefield1', 'attributefield1',...
In the QGIS online-manual I found only this information:
Input fields to keep [tablefield: any] [list]
Optional
Choose here the field(s) of the input layer to be kept. If no fields are chosen all fields are taken.
How do I set the list of fields there?
['attribute1', 'attribute2', ...]
? If that doesn't work, here's a workaround: runintersection
with the default setting of "keep all fields." Add a step to your model, remove unwanted fields with thedrop field(s)
algorithm.['attribute1', 'attribute2',...]
before. It doesn't work for me. I also tried your suggested workaround with thedrop field(s)
algorithm, but there i get the same problem. I don't get the syntax right for more than one attribute field. With just one field, it works without brackets and without any quotation marks, just the name of the attribute in the input line. But with more than one field, it doesn't work with or without marks or brackets. Or do i have to define the fields-to-keep in the intersection or drop-process by an additional input-variable?field1, field2
, it allows me to click OK without giving me an error. I haven't fully tested that the tool runs as expected, though.