[QGIS-Developer] Common PyQGIS functions for QGIS 3

Matthias Kuhn matthias at opengis.ch
Wed Feb 20 01:06:08 PST 2019


Hi Thomas,

Recently more and more is added to QGIS in the `qgis.utils` module, for 
example the latest addition is the `@alg` decorator for processing 
algorithms [1].

I really like these efforts and more additions are very welcome!

 From a workflow perspective, it's good to come up with a QEP or a 
thread on the mailing list first. Very often those snippets overcome 
shortcomings of the QGIS API which should rather be fixed on C++ side.

Bests

Matthias

[1] https://github.com/qgis/QGIS-Enhancement-Proposals/issues/134

On 20.02.19 09:38, Thomas Baumann wrote:
> Hi qgis-devs,
>
> I recently updated 15 QGIS-plugins to be QGIS3-ready. Most of them 
> were self written (in house) plugins but four of them were also 
> plugins from the official repository which were written by someone else.
>
> I noticed that there are severals tasks that have many plugins in 
> common like:
> - load a vectorlayer
> - add a layer to the layertree
> - iterate through all (visible?) layers of the layertree
> - show a message with different levels (info, warning, critical)
> - log messages
> - reading setting, writing settings
> - ...
>
> It seems a bit ineffective that every developer writes these common 
> task 'from scratch'.
>
> There already were some ideas to collect common functions that could 
> be re-used by plugin-developers:
>
> -some older functions (GIS2) like
>
> https://github.com/NathanW2/parfait
>
> https://github.com/qgis/pyqgis_wrappers
>
> and something newer like
>
> https://github.com/boundlessgeo/lib-qgis-commons 
> https://pypi.org/project/qgiscommons/
>
>
> One nice example for utilities collected for a (huge) plugin is:
>
> https://github.com/inasafe/inasafe/tree/master/safe/utilities
>
>
>
> Wouldn't it be possible to provide such a collection not only from 
> privat persons/projects but from the QGIS-project itself so users 
> could add common functions?
> I think the chances would be higher that such a "official" collection 
> would be used in the long run and constantly extended.
>
> Apart from the fact that developers could save time while writing 
> their plugins this could perhaps also help to improve the overall 
> quality of the qgis-plugins as there would probably be several persons 
> who could/would countercheck these common functions to make sure they 
> are well written.
>
> regards,
> Thomas
>
> PS: I asked something similar also on gis.stackexchange recently:
>
> https://gis.stackexchange.com/questions/311755/looking-for-common-pyqgis-functions-for-qgis-3 
>
>
>
>
>
>
> _______________________________________________
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20190220/18d6bf70/attachment.html>


More information about the QGIS-Developer mailing list