﻿{"id":16313,"date":"2026-06-30T10:00:00","date_gmt":"2026-06-30T08:00:00","guid":{"rendered":"https:\/\/www.sigterritoires.fr\/?p=16313"},"modified":"2026-06-20T21:06:00","modified_gmt":"2026-06-20T19:06:00","slug":"logique-metier-plugin-qgis","status":"publish","type":"post","link":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/","title":{"rendered":"[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies"},"content":{"rendered":"\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\">R\u00e9cup\u00e9rer des valeurs depuis une interface de <a href=\"https:\/\/www.sigterritoires.fr\/index.php\/plugin-qgis-debutant-introduction\/\">plugin QGIS<\/a> est une \u00e9tape importante, mais ce n\u2019est qu\u2019un d\u00e9but. La vraie question est : <strong>que faire de ces valeurs ?<\/strong><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dans cet article, nous allons voir comment <strong>appliquer une logique m\u00e9tier simple aux donn\u00e9es saisies par l\u2019utilisateur<\/strong>, afin de transformer une interface statique en un plugin QGIS r\u00e9ellement fonctionnel. L\u2019objectif n\u2019est pas d\u2019\u00e9crire du code complexe, mais de comprendre <strong>o\u00f9 placer la logique, comment la structurer, et comment \u00e9viter les erreurs classiques<\/strong> quand on d\u00e9bute.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_85 counter-hierarchy ez-toc-counter ez-toc-light-blue ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Contenu <\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#Appliquer_une_logique_metier_aux_valeurs_saisies_dans_un_plugin_QGIS\" >Appliquer une logique m\u00e9tier aux valeurs saisies dans un plugin QGIS<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#1_Quappelle-t-on_%E2%80%9Clogique_metier%E2%80%9D_dans_un_plugin_QGIS\" >1. Qu\u2019appelle-t-on \u201clogique m\u00e9tier\u201d dans un plugin QGIS ?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#2_Separer_interface_et_logique_sans_complexite_inutile\" >2. S\u00e9parer interface et logique (sans complexit\u00e9 inutile)<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#3_Exemple_simple_de_logique_metier\" >3. Exemple simple de logique m\u00e9tier<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#4_Gerer_les_erreurs_intelligemment\" >4. G\u00e9rer les erreurs intelligemment<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#5_Relier_la_logique_metier_a_linterface\" >5. Relier la logique m\u00e9tier \u00e0 l\u2019interface<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#Logique_metier_%E2%89%A0_code_complique\" >Logique m\u00e9tier \u2260 code compliqu\u00e9<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#6_Pourquoi_cette_etape_est_essentielle\" >6. Pourquoi cette \u00e9tape est essentielle<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#A_retenir\" >\u00c0 retenir<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Appliquer_une_logique_metier_aux_valeurs_saisies_dans_un_plugin_QGIS\"><\/span>Appliquer une logique m\u00e9tier aux valeurs saisies dans un plugin QGIS<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Dans l\u2019article pr\u00e9c\u00e9dent, nous avons vu comment <strong>r\u00e9cup\u00e9rer les valeurs saisies par l\u2019utilisateur<\/strong> depuis une interface (champ texte, liste d\u00e9roulante, case \u00e0 cocher\u2026).<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dans cet article, nous passons \u00e0 l\u2019\u00e9tape suivante : <strong>donner du sens \u00e0 ces valeurs<\/strong>.<br>C\u2019est ici qu\u2019intervient la <strong>logique m\u00e9tier<\/strong> du plugin.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"1_Quappelle-t-on_%E2%80%9Clogique_metier%E2%80%9D_dans_un_plugin_QGIS\"><\/span>1. Qu\u2019appelle-t-on \u201clogique m\u00e9tier\u201d dans un plugin QGIS ?<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">La logique m\u00e9tier correspond \u00e0 l\u2019ensemble des <strong>r\u00e8gles, calculs et d\u00e9cisions<\/strong> qui transforment des valeurs saisies en une action concr\u00e8te.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Dans un plugin QGIS, cela peut \u00eatre par exemple :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>v\u00e9rifier que des valeurs sont coh\u00e9rentes entre elles,<\/li>\n\n\n\n<li>calculer un seuil, une distance, un indice,<\/li>\n\n\n\n<li>d\u00e9cider si une op\u00e9ration doit \u00eatre lanc\u00e9e ou refus\u00e9e,<\/li>\n\n\n\n<li>transformer une saisie utilisateur en param\u00e8tres exploitables par QGIS.<\/li>\n<\/ul>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\"> <strong>R\u00e8gle cl\u00e9<\/strong> : la logique m\u00e9tier ne d\u00e9pend pas de l\u2019interface graphique. Elle doit pouvoir \u00eatre comprise ind\u00e9pendamment des boutons et des champs.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"2_Separer_interface_et_logique_sans_complexite_inutile\"><\/span>2. S\u00e9parer interface et logique (sans complexit\u00e9 inutile)<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Un plugin bien structur\u00e9 repose sur une s\u00e9paration simple :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Interface<\/strong> : collecte des valeurs (dialog, widgets)<\/li>\n\n\n\n<li><strong>Logique m\u00e9tier<\/strong> : traitement et validation des valeurs<\/li>\n\n\n\n<li><strong>Action QGIS<\/strong> : modification des couches, entit\u00e9s ou projets<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">M\u00eame dans un plugin simple, adopter cette s\u00e9paration \u00e9vite rapidement :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>les bugs difficiles \u00e0 comprendre,<\/li>\n\n\n\n<li>le code dupliqu\u00e9,<\/li>\n\n\n\n<li>les interfaces impossibles \u00e0 faire \u00e9voluer.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Concr\u00e8tement, cela signifie que le slot du bouton <strong>ne fait presque rien<\/strong> :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>r\u00e9cup\u00e9rer les valeurs,<\/li>\n\n\n\n<li>appeler une fonction de logique m\u00e9tier,<\/li>\n\n\n\n<li>r\u00e9agir au r\u00e9sultat.<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"3_Exemple_simple_de_logique_metier\"><\/span>3. Exemple simple de logique m\u00e9tier<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Imaginons un plugin avec :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>une valeur num\u00e9rique saisie par l\u2019utilisateur,<\/li>\n\n\n\n<li>un choix dans une liste d\u00e9roulante.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Avant toute action, on souhaite :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>v\u00e9rifier que la valeur est positive,<\/li>\n\n\n\n<li>appliquer un coefficient selon le choix utilisateur.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">La logique m\u00e9tier peut alors \u00eatre isol\u00e9e dans une fonction d\u00e9di\u00e9e :<\/p>\n\n\n<div class='stb-container stb-style-black'><div class='stb-caption'><div class='stb-logo'><img class='stb-logo__image' src='data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN\/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz\/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH\/w\/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCd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2WQtIfErPtXtlezHrOHL2vCt9uzkSL0irxqsb7pkpdU5o56Y9VhbGxoweudIcJFeWGqtzEy6vH20ODl\/f27qDymTzKqklWFiCL\/8wa566U81L4G8BPL\/A+R\/BgAzCInEE2+\/LgAAAABJRU5ErkJggg==' alt='img'\/><\/div><div class='stb-caption-content'><\/div><div class='stb-tool'><\/div><\/div><div class='stb-content'><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> def calculer_valeur(valeur, mode):\n     if valeur &lt;= 0:\n         raise ValueError(\"La valeur doit \u00eatre positive\")\n\n     if mode == \"simple\":\n         return valeur\n     elif mode == \"double\":\n         return valeur * 2\n     else:\n         raise ValueError(\"Mode inconnu\")\n<\/code><\/pre>\n\n\n<p><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Cette fonction :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>ne conna\u00eet rien de QGIS,<\/li>\n\n\n\n<li>ne conna\u00eet rien de l\u2019interface,<\/li>\n\n\n\n<li>fait une seule chose, clairement d\u00e9finie.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"4_Gerer_les_erreurs_intelligemment\"><\/span>4. G\u00e9rer les erreurs intelligemment<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Une logique m\u00e9tier robuste <strong>doit anticiper les erreurs<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Deux approches sont possibles :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>retourner un r\u00e9sultat + un \u00e9tat (succ\u00e8s \/ \u00e9chec),<\/li>\n\n\n\n<li>lever des exceptions et les intercepter c\u00f4t\u00e9 interface.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Dans un plugin QGIS, la seconde approche est souvent plus lisible :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>la logique m\u00e9tier signale un probl\u00e8me,<\/li>\n\n\n\n<li>l\u2019interface d\u00e9cide comment l\u2019afficher \u00e0 l\u2019utilisateur.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Cela permet par exemple :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>d\u2019afficher un message clair,<\/li>\n\n\n\n<li>de bloquer l\u2019ex\u00e9cution sans planter le plugin,<\/li>\n\n\n\n<li>de guider l\u2019utilisateur vers une correction.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"5_Relier_la_logique_metier_a_linterface\"><\/span>5. Relier la logique m\u00e9tier \u00e0 l\u2019interface<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Dans le slot du bouton, le r\u00f4le est volontairement limit\u00e9 :<\/p>\n\n\n<div class='stb-container stb-style-black'><div class='stb-caption'><div class='stb-logo'><img class='stb-logo__image' src='data:image\/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN\/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz\/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH\/w\/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDII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EE2+\/LgAAAABJRU5ErkJggg==' alt='img'\/><\/div><div class='stb-caption-content'><\/div><div class='stb-tool'><\/div><\/div><div class='stb-content'><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> def on_run_clicked(self):\n     try:\n         valeur = self.spinBoxValeur.value()\n         mode = self.comboBoxMode.currentText()\n\n         resultat = calculer_valeur(valeur, mode)\n\n         self.appliquer_resultat(resultat)\n\n     except ValueError as e:\n         QMessageBox.warning(self, \"Erreur\", str(e))\n<\/code><\/pre>\n\n\n<p><\/div><\/div>\n\n\n\n<p class=\"wp-block-paragraph\">Ce code est lisible car :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>chaque \u00e9tape est explicite,<\/li>\n\n\n\n<li>les responsabilit\u00e9s sont bien s\u00e9par\u00e9es,<\/li>\n\n\n\n<li>la logique m\u00e9tier reste testable ind\u00e9pendamment.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Logique_metier_%E2%89%A0_code_complique\"><\/span>Logique m\u00e9tier \u2260 code compliqu\u00e9<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Quand on d\u00e9bute le d\u00e9veloppement de plugins QGIS, on associe souvent la notion de <em>logique m\u00e9tier<\/em> \u00e0 quelque chose de complexe ou r\u00e9serv\u00e9 aux d\u00e9veloppeurs exp\u00e9riment\u00e9s. En r\u00e9alit\u00e9, ce n\u2019est pas la complexit\u00e9 du code qui d\u00e9finit la logique m\u00e9tier, mais <strong>l\u2019intention derri\u00e8re le traitement<\/strong>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Une logique m\u00e9tier simple peut se r\u00e9sumer \u00e0 :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>v\u00e9rifier qu\u2019une valeur est valide,<\/li>\n\n\n\n<li>appliquer une r\u00e8gle claire,<\/li>\n\n\n\n<li>d\u00e9cider si une action est autoris\u00e9e ou non.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Quelques lignes bien structur\u00e9es, lisibles et isol\u00e9es dans une fonction valent mieux qu\u2019un long bloc de code m\u00e9lang\u00e9 \u00e0 l\u2019interface.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"> Si vous comprenez <em>pourquoi<\/em> vous appliquez une r\u00e8gle, alors vous \u00eates d\u00e9j\u00e0 en train d\u2019\u00e9crire de la logique m\u00e9tier.<\/p>\n<\/blockquote>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"6_Pourquoi_cette_etape_est_essentielle\"><\/span>6. Pourquoi cette \u00e9tape est essentielle<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">C\u2019est \u00e0 ce stade que beaucoup de plugins deviennent :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>soit fragiles et difficiles \u00e0 maintenir,<\/li>\n\n\n\n<li>soit au contraire clairs, extensibles et fiables.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">En isolant la logique m\u00e9tier :<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>vous pouvez la faire \u00e9voluer sans toucher \u00e0 l\u2019interface,<\/li>\n\n\n\n<li>vous pouvez ajouter des r\u00e8gles sans r\u00e9\u00e9crire le plugin,<\/li>\n\n\n\n<li>vous pr\u00e9parez naturellement les articles suivants.<\/li>\n<\/ul>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h3 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"A_retenir\"><\/span>\u00c0 retenir<span class=\"ez-toc-section-end\"><\/span><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li>la logique m\u00e9tier donne du sens aux valeurs saisies,<\/li>\n\n\n\n<li>elle doit \u00eatre s\u00e9par\u00e9e de l\u2019interface graphique,<\/li>\n\n\n\n<li>elle doit g\u00e9rer les erreurs explicitement,<\/li>\n\n\n\n<li>c\u2019est le c\u0153ur r\u00e9el de votre plugin.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Dans le prochain article, nous verrons comment <strong>appliquer cette logique m\u00e9tier \u00e0 des couches et des entit\u00e9s QGIS<\/strong>, et passer enfin \u00e0 l\u2019action sur les donn\u00e9es.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n","protected":false},"excerpt":{"rendered":"<p>R\u00e9cup\u00e9rer des valeurs depuis une interface de plugin QGIS est une \u00e9tape importante, mais ce n\u2019est qu\u2019un d\u00e9but. La vraie question est : que faire de ces valeurs ? Dans cet article, nous allons voir comment&hellip;<\/p>\n","protected":false},"author":1,"featured_media":16306,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_bbp_topic_count":0,"_bbp_reply_count":0,"_bbp_total_topic_count":0,"_bbp_total_reply_count":0,"_bbp_voice_count":0,"_bbp_anonymous_reply_count":0,"_bbp_topic_count_hidden":0,"_bbp_reply_count_hidden":0,"_bbp_forum_subforum_count":0,"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[1945,62],"tags":[4222,4684,4204,4678,4682,4680],"class_list":["post-16313","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-pluigin","category-qgis-2","tag-developpement-plugin-qgis","tag-interface-qgis","tag-plugin-builder-fr","tag-pyqgis","tag-valeurs-saisies-utilisateur","tag-validation-des-donnees-qgis"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 4.9.9 - aioseo.com -->\n\t<meta name=\"description\" content=\"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Atilio Francois\"\/>\n\t<meta name=\"google-site-verification\" content=\"ByXHZUbGNn7RNv-Xk5A-ysTZrM65VLIO2RxfSJ2nIEQ\" \/>\n\t<meta name=\"keywords\" content=\"d\u00e9veloppement plugin qgis,interface qgis,plugin builder,pyqgis,valeurs saisies utilisateur,validation des donn\u00e9es qgis\" \/>\n\t<link rel=\"canonical\" href=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 4.9.9\" \/>\n\t\t<meta property=\"og:locale\" content=\"fr_FR\" \/>\n\t\t<meta property=\"og:site_name\" content=\"Blog SIG &amp; Territoires | le portail des professionnels du SIG\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"Comment appliquer une logique m\u00e9tier dans un plugin QGIS\" \/>\n\t\t<meta property=\"og:description\" content=\"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2026-06-30T08:00:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2026-06-20T19:06:00+00:00\" \/>\n\t\t<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/atilio.francois\/\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary\" \/>\n\t\t<meta name=\"twitter:site\" content=\"@SigTerritoires\" \/>\n\t\t<meta name=\"twitter:title\" content=\"Comment appliquer une logique m\u00e9tier dans un plugin QGIS\" \/>\n\t\t<meta name=\"twitter:description\" content=\"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.\" \/>\n\t\t<meta name=\"twitter:creator\" content=\"@SigTerritoires\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#article\",\"name\":\"Comment appliquer une logique m\\u00e9tier dans un plugin QGIS\",\"headline\":\"[FR]D\\u00e9velopper un plugin QGIS \\u2013 appliquer une logique m\\u00e9tier aux valeurs saisies\",\"author\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/author\\\/admin\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/#person\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.sigterritoires.fr\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/pluginsQGIS.jpg?fit=409%2C307&ssl=1\",\"width\":409,\"height\":307},\"datePublished\":\"2026-06-30T10:00:00+02:00\",\"dateModified\":\"2026-06-20T21:06:00+02:00\",\"inLanguage\":\"fr-FR\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#webpage\"},\"articleSection\":\"Plugin, QGis, d\\u00e9veloppement plugin QGIS, interface QGIS, plugin builder, PyQGIS, valeurs saisies utilisateur, validation des donn\\u00e9es QGIS, Fran\\u00e7ais\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.sigterritoires.fr\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/#listItem\",\"name\":\"QGis\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/#listItem\",\"position\":2,\"name\":\"QGis\",\"item\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/pluigin\\\/#listItem\",\"name\":\"Plugin\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/pluigin\\\/#listItem\",\"position\":3,\"name\":\"Plugin\",\"item\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/pluigin\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#listItem\",\"name\":\"[FR]D\\u00e9velopper un plugin QGIS \\u2013 appliquer une logique m\\u00e9tier aux valeurs saisies\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/#listItem\",\"name\":\"QGis\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#listItem\",\"position\":4,\"name\":\"[FR]D\\u00e9velopper un plugin QGIS \\u2013 appliquer une logique m\\u00e9tier aux valeurs saisies\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/category\\\/qgis-2\\\/pluigin\\\/#listItem\",\"name\":\"Plugin\"}}]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/#person\",\"name\":\"Atilio Francois\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#personImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f76dc2a720162999bce81d6c99b6d7b9517d6600ad7ceb5ed5268f02cefaa0ee?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Atilio Francois\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/author\\\/admin\\\/#author\",\"url\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/author\\\/admin\\\/\",\"name\":\"Atilio Francois\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#authorImage\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/f76dc2a720162999bce81d6c99b6d7b9517d6600ad7ceb5ed5268f02cefaa0ee?s=96&d=mm&r=g\",\"width\":96,\"height\":96,\"caption\":\"Atilio Francois\"}},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#webpage\",\"url\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/\",\"name\":\"Comment appliquer une logique m\\u00e9tier dans un plugin QGIS\",\"description\":\"Apprenez \\u00e0 appliquer une logique m\\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.\",\"inLanguage\":\"fr-FR\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/author\\\/admin\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/author\\\/admin\\\/#author\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/www.sigterritoires.fr\\\/wp-content\\\/uploads\\\/2026\\\/01\\\/pluginsQGIS.jpg?fit=409%2C307&ssl=1\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#mainImage\",\"width\":409,\"height\":307},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/index.php\\\/logique-metier-plugin-qgis\\\/#mainImage\"},\"datePublished\":\"2026-06-30T10:00:00+02:00\",\"dateModified\":\"2026-06-20T21:06:00+02:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/#website\",\"url\":\"https:\\\/\\\/www.sigterritoires.fr\\\/\",\"name\":\"Blog SIG & Territoires\",\"description\":\"le portail des professionnels du SIG\",\"inLanguage\":\"fr-FR\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.sigterritoires.fr\\\/#person\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","description":"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.","canonical_url":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/","robots":"max-image-preview:large","keywords":"d\u00e9veloppement plugin qgis,interface qgis,plugin builder,pyqgis,valeurs saisies utilisateur,validation des donn\u00e9es qgis","webmasterTools":{"google-site-verification":"ByXHZUbGNn7RNv-Xk5A-ysTZrM65VLIO2RxfSJ2nIEQ","miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#article","name":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","headline":"[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies","author":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/author\/admin\/#author"},"publisher":{"@id":"https:\/\/www.sigterritoires.fr\/#person"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2026\/01\/pluginsQGIS.jpg?fit=409%2C307&ssl=1","width":409,"height":307},"datePublished":"2026-06-30T10:00:00+02:00","dateModified":"2026-06-20T21:06:00+02:00","inLanguage":"fr-FR","mainEntityOfPage":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#webpage"},"isPartOf":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#webpage"},"articleSection":"Plugin, QGis, d\u00e9veloppement plugin QGIS, interface QGIS, plugin builder, PyQGIS, valeurs saisies utilisateur, validation des donn\u00e9es QGIS, Fran\u00e7ais"},{"@type":"BreadcrumbList","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr#listItem","position":1,"name":"Home","item":"https:\/\/www.sigterritoires.fr","nextItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/#listItem","name":"QGis"}},{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/#listItem","position":2,"name":"QGis","item":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/#listItem","name":"Plugin"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/#listItem","position":3,"name":"Plugin","item":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/","nextItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#listItem","name":"[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies"},"previousItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/#listItem","name":"QGis"}},{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#listItem","position":4,"name":"[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies","previousItem":{"@type":"ListItem","@id":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/#listItem","name":"Plugin"}}]},{"@type":"Person","@id":"https:\/\/www.sigterritoires.fr\/#person","name":"Atilio Francois","image":{"@type":"ImageObject","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#personImage","url":"https:\/\/secure.gravatar.com\/avatar\/f76dc2a720162999bce81d6c99b6d7b9517d6600ad7ceb5ed5268f02cefaa0ee?s=96&d=mm&r=g","width":96,"height":96,"caption":"Atilio Francois"}},{"@type":"Person","@id":"https:\/\/www.sigterritoires.fr\/index.php\/author\/admin\/#author","url":"https:\/\/www.sigterritoires.fr\/index.php\/author\/admin\/","name":"Atilio Francois","image":{"@type":"ImageObject","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#authorImage","url":"https:\/\/secure.gravatar.com\/avatar\/f76dc2a720162999bce81d6c99b6d7b9517d6600ad7ceb5ed5268f02cefaa0ee?s=96&d=mm&r=g","width":96,"height":96,"caption":"Atilio Francois"}},{"@type":"WebPage","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#webpage","url":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/","name":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","description":"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.","inLanguage":"fr-FR","isPartOf":{"@id":"https:\/\/www.sigterritoires.fr\/#website"},"breadcrumb":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#breadcrumblist"},"author":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/author\/admin\/#author"},"creator":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/author\/admin\/#author"},"image":{"@type":"ImageObject","url":"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2026\/01\/pluginsQGIS.jpg?fit=409%2C307&ssl=1","@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#mainImage","width":409,"height":307},"primaryImageOfPage":{"@id":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/#mainImage"},"datePublished":"2026-06-30T10:00:00+02:00","dateModified":"2026-06-20T21:06:00+02:00"},{"@type":"WebSite","@id":"https:\/\/www.sigterritoires.fr\/#website","url":"https:\/\/www.sigterritoires.fr\/","name":"Blog SIG & Territoires","description":"le portail des professionnels du SIG","inLanguage":"fr-FR","publisher":{"@id":"https:\/\/www.sigterritoires.fr\/#person"}}]},"og:locale":"fr_FR","og:site_name":"Blog SIG &amp; Territoires | le portail des professionnels du SIG","og:type":"article","og:title":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","og:description":"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.","og:url":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/","article:published_time":"2026-06-30T08:00:00+00:00","article:modified_time":"2026-06-20T19:06:00+00:00","article:publisher":"https:\/\/www.facebook.com\/atilio.francois\/","twitter:card":"summary","twitter:site":"@SigTerritoires","twitter:title":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","twitter:description":"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.","twitter:creator":"@SigTerritoires"},"aioseo_meta_data":{"post_id":"16313","title":"Comment appliquer une logique m\u00e9tier dans un plugin QGIS","description":"Apprenez \u00e0 appliquer une logique m\u00e9tier dans un plugin QGIS. Validez les valeurs saisies, contr\u00f4lez les actions et rendez vos outils PyQGIS plus fiables et intelligents.","keywords":null,"keyphrases":{"focus":{"keyphrase":"logique m\u00e9tier plugin QGIS","score":39,"analysis":{"keyphraseInTitle":{"score":3,"maxScore":9,"error":1},"keyphraseInDescription":{"score":3,"maxScore":9,"error":1},"keyphraseLength":{"score":6,"maxScore":9,"error":1,"length":5},"keyphraseInURL":{"score":5,"maxScore":5,"error":0},"keyphraseInIntroduction":{"score":3,"maxScore":9,"error":1},"keyphraseInSubHeadings":{"score":3,"maxScore":9,"error":1},"keyphraseInImageAlt":[],"keywordDensity":{"score":0,"type":"low","maxScore":9,"error":1}}},"additional":[]},"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_url":null,"og_image_width":null,"og_image_height":null,"og_image_custom_url":null,"og_image_custom_fields":null,"og_video":"","og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_url":null,"twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_title":null,"twitter_description":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"Article","isEnabled":true},"graphs":[]},"schema_type":"default","schema_type_options":null,"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":"-1","robots_max_videopreview":"-1","robots_max_imagepreview":"large","priority":null,"frequency":"default","local_seo":null,"breadcrumb_settings":null,"limit_modified_date":false,"ai":{"faqs":[],"keyPoints":[],"schemas":[],"titles":[],"descriptions":[],"socialPosts":{"email":[],"linkedin":[],"twitter":[],"facebook":[],"instagram":[]}},"created":"2026-01-30 02:28:34","updated":"2026-06-30 09:14:59","seo_analyzer_scan_date":null},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.sigterritoires.fr\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/\" title=\"QGis\">QGis<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/\" title=\"Plugin\">Plugin<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/www.sigterritoires.fr"},{"label":"QGis","link":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/"},{"label":"Plugin","link":"https:\/\/www.sigterritoires.fr\/index.php\/category\/qgis-2\/pluigin\/"},{"label":"[FR]D\u00e9velopper un plugin QGIS \u2013 appliquer une logique m\u00e9tier aux valeurs saisies","link":"https:\/\/www.sigterritoires.fr\/index.php\/logique-metier-plugin-qgis\/"}],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.sigterritoires.fr\/wp-content\/uploads\/2026\/01\/pluginsQGIS.jpg?fit=409%2C307&ssl=1","jetpack_shortlink":"https:\/\/wp.me\/p6XU0A-4f7","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/16313","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/comments?post=16313"}],"version-history":[{"count":0,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/posts\/16313\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media\/16306"}],"wp:attachment":[{"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/media?parent=16313"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/categories?post=16313"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.sigterritoires.fr\/index.php\/wp-json\/wp\/v2\/tags?post=16313"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}