[QGIS-Developer] How to call a custom algorithm provider in stand alone application with pyqgis

PALMIER Patrick (Responsable de groupe) - CEREMA/DTerNP/DATHa/MT Patrick.Palmier at cerema.fr
Tue Nov 3 00:50:34 PST 2020


Hello,

Yes, the environmental variables ton run a standalone script in python 
are set up and it works
I just want know how to run my personnal processing  algorithm, but I 
don't know how to manually add my alg provider in the alg provider registry

qgis_process is an interesting way, but I prefer if possible calling it 
directly  in PyQgis because it's part of a wider app

Thanks


Best regards


Le 02/11/2020 à 18:15, > nagyrobi_r (par Internet) a écrit :
> Did you set up the environmental variables to run it as a standalone 
> script in python?
> Like in section 1.4.3?
> https://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/intro.html#using-pyqgis-in-standalone-scripts
> On Monday, November 2, 2020, 06:02:11 PM GMT+1, Etienne Trimaille 
> <etienne.trimaille at gmail.com> wrote:
>
>
> As you are using QGIS 3.14, I would suggest you to use qgis_process if 
> you can.
> Do you really want to use PyQGIS?
>
> But if you really need PyQGIS, maybe the path where your script is 
> located is not known to your standalone script ?
>
> Le lun. 2 nov. 2020 à 17:33,  a écrit :
>
>     Hello,
>
>     I work with Qgis 3.14 in Windows 10
>
>     I try to call a processing algorithm from a python stand alone app,
>     I want to run the following script from the custom Networks
>     algorithm provider but I have the message that the algorithm is
>     not known
>
>     How to register the provider in the processing registry to be able
>     to call it?
>
>
>         QgsApplication.setPrefixPath("C:/Program Files/QGIS
>     3.14/apps/qgis", True)
>         qgs = QgsApplication([], False)
>
>         qgs.initQgis()
>         import processing
>         from processing.core.Processing import Processing
>         Processing.initialize()
>
>
>
>     processing.run("Networks:musliw_simple_matrix",
>     {'NODES':'G:/BD_DREAL/2020/script_modele_resmultimodal_light   /noeuds_light_hdf_be.gpkg','NUM':'num','START_POINT':'708675.425564,7063676.157556
>     [EPSG:2154]','END_POINT':'708675.425564,7063676.157556[EPSG:2154]','DEMAND':1,'DAY':1,'TIME':'09:00:00','DEPARTURE':1,'OUTPUT':'G:/BD_DREAL/2020/script_modele_resmultimodal_light/matrice.txt','WRITE_MODE':0})
>
>     Thanks
>
>     Best regards
>
>     -- 
>
>
>     _______________________________________________
>     QGIS-Developer mailing list
>     QGIS-Developer at lists.osgeo.org <mailto: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
>
> _______________________________________________
> QGIS-Developer mailing list
> QGIS-Developer at lists.osgeo.org <mailto: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/20201103/7d2bada9/attachment.html>


More information about the QGIS-Developer mailing list