[QGIS-Developer] EditInPlace Processing script

Germán Carrillo carrillo.german at gmail.com
Tue Apr 14 09:57:24 PDT 2020


Hi Matteo,

yes, it's possible to write custom Processing scripts for editing layers
in-place.

Here you can find an example (buffer):
https://github.com/gacarrillor/QGIS-Resources/blob/master/collections/processing_scripts/processing/processing_script_edit_in_place.py

>From the example we can see:

   - We need to set the QgsProcessingAlgorithm.FlagSupportsInPlaceEdits
   flag for our algorithm.
   - It's not required that our algorithm inherits from
   QgsProcessingFeatureBasedAlgorithm for it to support edit-in-place[*].
   - The supportInPlaceEdit() method allows us to specify for which layers
   our algorithm can be offered as edit-in-place.

Regards,

Germán
--------------------
[*] As a demo, the buffer example is OK. However, since each feature
generates a new feature without needing other source features, the buffer
example could also be written as a QgsProcessingFeatureBasedAlgorithm. :)

El mar., 14 abr. 2020 a las 3:22, matteo (<matteo.ghetta at gmail.com>)
escribió:

> Hi Arnaud,
>
> I explored the QgsProcessingFeatureBasedAlgorithm but unfortunately is
> not the case of what I'm looking for. From what I understood
> QgsProcessingFeatureBasedAlgorithm is the class to use when the
> algorithm performs "feature-by-feature" operations like buffers.
>
> In my case I would like to "change" the geometry of the input layer
> (union and dissolve).
>
> Cheers and thanks for the input anyway!
>
> Matteo
> _______________________________________________
> 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



-- 
-----------
   |\__
(:>__)(
   |/
Soluciones Geoinformáticas Libres <http://geotux.tuxfamily.org/>

https://twitter.com/GeoTux2 <http://twitter.com/GeoTux2>

Grupo de Usuarios QGIS Colombia <http://qgisusers.co>
<http://qgisusers.co>
https://twitter.com/qgiscolombia
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20200414/8b4bfe3b/attachment.html>


More information about the QGIS-Developer mailing list