[QGIS-Developer] Run processing model on selected features only

Nyall Dawson nyall.dawson at gmail.com
Wed Dec 13 14:20:01 PST 2017


On 12 December 2017 at 00:10, Andreas Neumann <a.neumann at carto.net> wrote:
> Thanks for the information. Unfortunately I cannot use "Feature Source" as
> an input in my model.
>
> Matthias told me that I have to use "Vector layer" as an input, because my
> model relies on certain features that aren't available on "feature source"
> inputs. I need to use refactor fields in a model with expressions support
> for relation_aggregates and represent_value (which requires information on
> widget configuration).
>

Hi Andreas,

Thanks for your feedback while testing the new processing modeler...
it's very valuable information!

> I also find it quite confusing that the inputs come with zero documentation.
> I think for probably 99% of the users who are not devs it isn't obvious when
> to use which input. Could we introduce a very simple tooltip that explains
> with 1 or 2 sentences what the input implies - esp. for the "Vector layer"
> vs. "Feature Source" vs. "Layer field" ?

I need to improve how this is exposed in the modeler, but the
difference between "Feature sources" and "vector layers" is that
feature sources are used wherever *features* from a layer are being
processed, vs "vector layer" parameters which are for processes which
alter the whole layer (e.g changing its style, adding a field in
place, deleting/renaming it, etc)

Accordingly, all algorithms which edit features should be made to work
fully with "feature sources". In this case, we need to fix the
refactor fields algorithm to handle the relation/represent value use
cases somehow. But the proper solution here isn't to require a vector
layer parameter.

(Note that ALL algorithms which use feature source parameters will
happily accept a vector layer parameter and operate on the all the
features in that layer... but that's just done to make the modeler as
flexible as possible).

I plan on renaming "Feature Source" -> "Vector layer features" in the
modeler to help clarify this (also "layer field" -> "vector layer
field"), and I'll add some tooltips too. (also sort that list)

> Is there any chance this checkbox could also be introduced for "Vector
> layer" inputs? Should I open an issue?

Based on the above - no. Vector Layer parameters operate on a whole
layer... so what would a "selected features" checkbox mean for an
algorithm like "rename layer"? Or for setting layer styles? It's just
opening up a can of worms....

Another (related) question. I've been thinking model input UI should
be reworked. My proposal:
- remove the list of input types
- change it to a dock with a list of inputs present in the current
model, with an "add" (and remove) button to add new inputs to the
model (at which point the input type selection will be asked)
- add up/down reordering controls for inputs (supported in the backed,
but in the frontend there's no way to set the ordering. Which is a
pain for making end-user usable models)

Thoughts?

Nyall


>
> On 2017-12-11 15:01, Mathieu Pellerin wrote:
>
> The global use only selected features option is gone (yay) in favor of a
> checkbox which can be activated on a per-use basis. I believe iterating
> through selected features only requires a vector source input.
>
> On Dec 11, 2017 20:57, "Andreas Neumann" <a.neumann at carto.net> wrote:
>>
>> Hi,
>>
>> In QGIS master (version 3), with a Vector Layer input, I am failing to
>> find the option to run a processing model only on the selected features.
>>
>> Can you please help me find the setting? I looked in the "Options" -->
>> "Settings" --> "Processing" or watched out for a checkbox in the "Run model
>> dialog" - but both did not show an option to restrict on selected features
>> only.
>>
>> Thanks for a hint,
>>
>> Andreas
>>
>>
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list