[QGIS-Developer] EditInPlace Processing script

Arnaud Morvan arnaud.morvan at camptocamp.com
Thu Apr 9 04:38:09 PDT 2020


Note that when heriting form QgsProcessingFeatureBasedAlgorithm,

you do not have to implement processAlgorithm method which is already 
implemented in QgsProcessingFeatureBasedAlgorithm

but should implement the processFeature method.

Arnaud Morvan
Ingénieur logiciel
Tél: +33 (0)4 58 48 20 32

Camptocamp France SAS
18 rue du Lac Saint André
Savoie Technolac - Bâtiment Le Dauphin
F-73370 Le Bourget du Lac
http://www.camptocamp.com

Le 09/04/2020 à 13:35, Arnaud Morvan a écrit :
> Hello Matteo,
>
> As far as I know, if your algorithm :
>
>     does not change the table structure (geometry type, fields list 
> and their types)
>
>     is an instance of QgsProcessingFeatureBasedAlgorithm (output one 
> feature for each input feature)
>
> In brief:
>
>     - If your algorithm output one feature for each input feature:
>
>        => your should inherit from QgsProcessingFeatureBasedAlgorithm.
>
>     - If your outputs features have same geometry type and same fields 
> with same types:
>
>        => you can put the flag on your algorithm as it can be used for 
> in place editing.
>
> When in place editing is checked in dialog, output features replace 
> input features in source instead of being appended to an output.
>
> Arnaud Morvan
> Ingénieur logiciel
> Tél: +33 (0)4 58 48 20 32
>
> Camptocamp France SAS
> 18 rue du Lac Saint André
> Savoie Technolac - Bâtiment Le Dauphin
> F-73370 Le Bourget du Lac
> http://www.camptocamp.com
>
> Le 09/04/2020 à 10:53, matteo a écrit :
>> Hi all,
>>
>> is it possible to write a custom Processing script that can edit the
>> input layer in place (with the core functionality of course)?
>>
>> In the documentation I found the method to check if the algorithm
>> supports the in place editing [0] but not the method to set the script
>> to support the functionality.
>>
>> There are a few python core algorithms with
>>
>> Thanks for any hint!
>>
>> Cheers
>>
>> Matteo
>>
>>
>> [0]
>> https://qgis.org/pyqgis/3.10/core/QgsProcessingAlgorithm.html#qgis.core.QgsProcessingAlgorithm.supportInPlaceEdit 
>>
>> _______________________________________________
>> 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