QGIS Plugins mit Python: Unterschied zwischen den Versionen

Aus Geometa Lab OST
Zur Navigation springen Zur Suche springen
Keine Bearbeitungszusammenfassung
 
(56 dazwischenliegende Versionen von 6 Benutzern werden nicht angezeigt)
Zeile 1: Zeile 1:
Siehe auch:
QGIS Plugin metadata
* [[QGIS]], [[QGIS - Tipps und Tricks]], [[Python]]


Wichtige Informationen:
==  Importance of metadata  ==
* Dokumentation/Tutorials:
The metadata.txt file is essential for defining the properties of a QGIS plugin. It provides key information such as the plugin name, author details, description, and category. Properly structured metadata ensures that plugins are correctly categorized, easily discoverable, and well-documented.
** [http://www.qgis.org/pyqgis-cookbook/intro.html#python-applications PyQGis Cookbook] (QGIS Documentation), insbesondere [http://www.qgis.org/pyqgis-cookbook/plugins.html Kap. 'Developing Python Plugins'] (PyQGIS, QT4, Eclipse, Eclipse PyDev)
** [http://www.qgis.org/wiki/Writing_Python_Plugins 'Writing Python Plugins'] (QGIS Wiki)
* QGIS-Python-Plugin-Verzeichnis: C:\Documents and Settings\<username>\.qgis\python\plugins (Windows).
* QTDesigner unter Windows ist nun Bestandteil von der QT IDE [http://qt.nokia.com/products/ QTCreator].  


QGIS Plugins mit Python:
Keep metadata.txt updated – Especially when releasing new versions.
* Documentation zum Schreiben von PyQGIS-Plugins:
** QGIS Manual - Guide: http://qgis.org/en/documentation/manuals.html > QGIS Coding and Compilation Guide
** Forum: http://forum.qgis.org/viewforum.php?f=5
** Wiki-Artikel: http://www.qgis.org/wiki/Writing_Python_Plugins
* Tutorials / Bücher:
** [http://blog.qgis.org/node/59 Quantum GIS Blog]
** [http://www.qgis.org/wiki/Writing_Python_Plugins#How_to_debug_a_plugin_using_PDB How to debug a plugin using PDB] on QGIS Wiki (for C++ on Linux see [http://www.qgis.org/wiki/How_to_debug_QGIS_Plugins How to debug QGIS pugins])
** ''Rapid GUI Programming with Python and Qt'', Summerfield, Mark - Gutes Buch zu PyQt 4, Python und QT wird auch erklärt.
* Tools:
** QGIS Python Plugin Builder: http://pyqgis.org/builder/plugin_builder.py


Manuelles Installieren eines Python-Plugins myPlugin:
== Structure of metadata.txt  ==
* Download myPlugin.zip.
A metadata.txt file consists of mandatory and optional attributes. Below is a breakdown of the most important attributes.
* Auspacken von myPlugin in einem temporären Verzeichnis; nun sollte ein Ordner myPlugin/ vorhanden sein.
* Den Ordner myPlugin ins QGIS-Python-Plugin-Verzeichnis kopieren.
* QGIS (neu) starten und "Erweiterungen verwalten..." wählen. Dort sollte ein neuer Eintrag stehen => ankreuzen.


== Eclipse/PyDev mit Unit-Testing und Debugging ==
=== General Information  ===
* name: The official name of the plugin.
* author: Name(s) of the developer(s).
* email: Contact email for support or inquiries.
* qgisMinimumVersion: Minimum version of QGIS required to run the plugin (e.g., ''3.0'').
* description=Short and clear description of the plugin functionality.
* about=Detailed explanation of the plugin, including its purpose, features, and how it works.
* tags= Example: ''vector, geocoding, point, address''
* hasProcessingProvider: ''yes'' if the plugin provides QGIS processing tools.


Wie kann man Eclipse mit PyDev zum Entwickeln von QGIS-Plugins (QT4) aufsetzen inklusive Unit-Testing und Debugging (gem. [http://www.qgis.org/pyqgis-cookbook/intro.html#python-applications] )?
=== Versioning and Status ===
version=1.0
experimental=False
Changelog: 1.0 - Initial release.


=== Installation Eclipse ===
=== Category ===
Ensure category is valid – Choose one from the predefined list:
* '''Raster'''
* '''Vector'''
* '''Database'''
* '''Mesh'''
* '''Web'''


* Download minimalstes Eclipse 3.x, sprich nur Eclipse Platform Runtime Binary, welches leider nicht direkt auf der Hauptseite verfügbar ist
=== Links ===
# http://download.eclipse.org/eclipse/downloads/eclipse3x.php
Include a homepage or repository link – Essential for documentation and support.
# -> Latest Release
tracker=https://github.com/johndoe/spatial-analysis-plugin/issues
# Zur Platform Runtime Binary Sektion navigieren und entsprechenden Download starten
repository=https://github.com/johndoe/spatial-analysis-plugin
# Installation
homepage=https://github.com/johndoe/spatial-analysis-plugin


=== Einrichten Eclipse ===
=== Additional Settings ===
* icon: Path to the plugin icon.
* server: Set to True if the plugin runs on a server.


* Installation/Einrichten des Eclipse Marketplace
== Example of a Well-Formatted metadata.txt File ==
# Eclipse starten
# ''Help->Install New Software''
# ''Indigo - http://download.eclipse.org/releases/indigo'' als Quelle auswählen
# Im Filter Feld ''Market'' eingeben
# '''Marketplace Client''' auswählen und installieren


* Installation PyDev
[general]
# ''Help->Eclipse Marketplace...''
name=Advanced Spatial Analysis
# Im Suchfeld nach '''pydev''' suchen
author=John Doe
# ''PyDev - Python IDE for Eclipse'' installieren
email=johndoe@example.com
# Konfiguration nach Eclipse Neustart:
qgisMinimumVersion=3.0
# ''Window->Preferences''
description=Perform advanced spatial analysis on vector layers.
# ''PyDev->Interpreter - Python'' für Linux oder ''PyDev->Interpreter - Iron Python'' und dann '''Auto Config''' wählen
about=This plugin allows users to conduct advanced spatial analysis operations such as buffering, clipping, and overlay analysis. It integrates seamlessly with the QGIS processing framework.
category=Vector
tags=vector, spatial analysis, geoprocessing
version=1.2
experimental=False
Changelog: 1.2 - Added new analysis tools.
tracker=https://github.com/johndoe/spatial-analysis-plugin/issues
repository=https://github.com/johndoe/spatial-analysis-plugin
homepage=https://github.com/johndoe/spatial-analysis-plugin
hasProcessingProvider=yes
icon=icon.png
server=False
There is more information about how a metadata.txt file should look like in the [https://docs.qgis.org/3.34/en/docs/pyqgis_developer_cookbook/plugins/plugins.html#metadata-txt pyqgis developer cookbook].


;Hinweis
== Weblinks ==
:PyDev und den eingebauten Debugger kennen lernen: http://www.vogella.de/articles/Python/article.html
* Homepage: http://www.qgis.org/ ([http://wiki.qgis.org/qgiswiki/Project_Organigram Project-Team QGIS])
* Wiki: http://wiki.qgis.org/
* Blog: http://blog.qgis.org
* Bug tracker: https://trac.osgeo.org/qgis/


* Optional: Sourcecontrol EGit einrichten
[[Kategorie:QGIS]] [[Kategorie:Python]] [[Kategorie:Programmieren]] [[Kategorie:QGIS-Plugin]]
# ''Help->Eclipse Marketplace...''
# Im Suchfeld nach '''egit''' suchen
# ''EGit - Git Team Provider'' auswählen und installieren
 
* CDT
# ''Help->Install New Software''
# ''Indigo - http://download.eclipse.org/releases/indigo'' als Quelle auswählen
# In der Kategorie Programming Languages ''C/C++ Development Tools'' auswählen und installieren
 
* Python und QT4
# Folgende Pakete müssen für Linux, am Beispiel Ubuntu, installiert werden um mit qt4 und sqlite arbeiten zu können
## python-qt4-sql
## python-qt4-dev
## libqt4-dev
## libqt4-sql-sqlite
## qt4-dev-tools
## qt4-doc-html
## pyqt4-dev-tools
 
* Installation Eclipse Plugin
# Download von http://qt.nokia.com/products/eclipse-integration/
 
;Hinweis
:Um die qt-Umgebung, sprich Designer etc. kennen zu lernen, ist das eingebaute Eclipse-CheatSheet sehr gut geeignet. Eclipse->Help->Cheat Sheets...
:Ein Wiki mit vielen Tutorials gibts hier: http://diotavelli.net/PyQtWiki/Tutorials
 
Eine alternative Anleitung zur Installation gibts hier: http://popdevelop.com/2010/04/setting-up-ide-and-creating-a-cross-platform-qt-python-gui-application/
 
* QGIS installieren
# Nach Anleitung von http://www.qgis.org/wiki/Download vorgehen
# Zur Entwicklung libqgis-dev zusätzlich installieren
 
 
=== Debugging von Python-Programmen mit Eclipse ===
* Mittels remote-debugging: http://pydev.org/manual_adv_remote_debugger.html
** und folgendem Stück Code im auszuführenden Programm: https://gist.github.com/1118602
 
=== Testing von PyQT Apps ===
 
* Testen von Qt-GUI Komponenten: http://www.voom.net/pyqt-qtest-example
 
 
  tbd. (Marcel)
 
[[Kategorie:Geoprocessing]]

Aktuelle Version vom 28. Januar 2025, 13:22 Uhr

QGIS Plugin metadata

Importance of metadata

The metadata.txt file is essential for defining the properties of a QGIS plugin. It provides key information such as the plugin name, author details, description, and category. Properly structured metadata ensures that plugins are correctly categorized, easily discoverable, and well-documented.

Keep metadata.txt updated – Especially when releasing new versions.

Structure of metadata.txt

A metadata.txt file consists of mandatory and optional attributes. Below is a breakdown of the most important attributes.

General Information

  • name: The official name of the plugin.
  • author: Name(s) of the developer(s).
  • email: Contact email for support or inquiries.
  • qgisMinimumVersion: Minimum version of QGIS required to run the plugin (e.g., 3.0).
  • description=Short and clear description of the plugin functionality.
  • about=Detailed explanation of the plugin, including its purpose, features, and how it works.
  • tags= Example: vector, geocoding, point, address
  • hasProcessingProvider: yes if the plugin provides QGIS processing tools.

Versioning and Status

version=1.0
experimental=False
Changelog: 1.0 - Initial release.

Category

Ensure category is valid – Choose one from the predefined list:

  • Raster
  • Vector
  • Database
  • Mesh
  • Web

Links

Include a homepage or repository link – Essential for documentation and support.

tracker=https://github.com/johndoe/spatial-analysis-plugin/issues
repository=https://github.com/johndoe/spatial-analysis-plugin
homepage=https://github.com/johndoe/spatial-analysis-plugin

Additional Settings

  • icon: Path to the plugin icon.
  • server: Set to True if the plugin runs on a server.

Example of a Well-Formatted metadata.txt File

[general]
name=Advanced Spatial Analysis
author=John Doe
email=johndoe@example.com
qgisMinimumVersion=3.0
description=Perform advanced spatial analysis on vector layers.
about=This plugin allows users to conduct advanced spatial analysis operations such as buffering, clipping, and overlay analysis. It integrates seamlessly with the QGIS processing framework.
category=Vector
tags=vector, spatial analysis, geoprocessing
version=1.2
experimental=False
Changelog: 1.2 - Added new analysis tools.
tracker=https://github.com/johndoe/spatial-analysis-plugin/issues
repository=https://github.com/johndoe/spatial-analysis-plugin
homepage=https://github.com/johndoe/spatial-analysis-plugin
hasProcessingProvider=yes
icon=icon.png
server=False

There is more information about how a metadata.txt file should look like in the pyqgis developer cookbook.

Weblinks