Outdated version of the documentation. Find the latest one here.

Créer une extensions Processing

Suivant le type d’extension que vous voulez développer, il sera parfois plus judicieux d’ajouter sa fonctionnalité sous forme d’un algorithme Processing (ou un ensemble d’algorithmes). Cela vous apportera une meilleure intégration au sein de QGIS, des fonctionnalités supplémentaires (puisqu’elle pourra être également lancée dans les composants de Processing comme le modeleur ou l’interface de traitements par lots), ainsi qu’un temps de développement plus court (puisque Processing va gérer une grande partie du travail).

This document describes how to create a new plugin that adds its functionality as Processing algorithms.

There are two main mechanisms for doing that:

  • Creating a plugin that adds an algorithm provider: This options is more complex, but provides more flexibility
  • Creating a plugin that contains a set of processing scripts: The simplest solution, you just need a set of Processing script files.

Creating a plugin that adds an algorithm provider

To create an algorithm provider, follow these steps:

  • Installez l’extension Plugin Builder

  • Créez une nouvelle extension à l’aide de Plugin Builder. Lorsque l’application vous demande le modèle à utiliser, sélectionnez “Processing Provider”.

  • L’extension créée contient un fournisseur disposant d’un seul algorithme. Les fichiers du fournisseur et de l’algorithme sont correctement commentés et contiennent de l’information sur comment modifier le fournisseur et comment ajouter de nouveaux algorithmes. S’y référerer pour plus d’informations.

Creating a plugin that contains a set of processing scripts

To create a set of processing scripts, follow these steps:

  • Create your scripts as described in the PyQGIS cookbook. All the scripts that you want to add, you should have them available in the Processing toolbox.
  • In the Scripts/Tools group in the Processing toolbox, double-click on the Create script collection plugin item. You will see a window where you should select the scripts to add to the plugin (from the set of available ones in the toolbox), and some additional information needed for the plugin metadata.
  • Click on OK and the plugin will be created.
  • You can add additional scripts to the plugin by adding scripts python files to the scripts folder in the resulting plugin folder.