[Qgis-user] passing parameters to QGIS Python-Script started via Command Line
Bo Victor Thomsen
bo.victor.thomsen at gmail.com
Mon Aug 8 07:26:02 PDT 2022
Try to look up "|QGIS Processing Executor|",
https://docs.qgis.org/3.22/en/docs/user_manual/processing/standalone.html
Med venlig hilsen / Kind regards
Bo Victor Thomsen
Den 08-08-2022 kl. 15:47 skrev Drexel Peter via Qgis-user:
>
> Hi everyone,
>
> My goal: I want to open QGIS using the Command-Line, load a specific
> project, select specific features and zoom to the selected features.
>
> What sounds rather difficult is actually mostly solvable using the
> following:
>
> "C:\Program Files\QGIS 3.16\bin\qgis-ltr-bin.exe" -p
> "d:\standardebenen.qgs" --code myscript.py
>
> This opens QGIS with the Project d:\standardebenen.qgs and after that
> it runs the script “myscript.py”.
>
> Within the scrip I can do everything what I can do in a Python-script,
> so there I can select some features in a layer and show that selection.
>
> But this selections are “hard-coded” in the script, I cannot pass over
> these parameters to the myscript.py.
>
> In “Pure Python” I can pass parameters to a Python Script using
> “python myscript.py arg1 arg2 arg3”.
>
> This seems to be not working in the QGIS-Command-Line as the
> parameters are interpreted as “layers to load”.
>
> Am I right with my analysis?
>
> One workaround is to write the parameters to al file and use this file
> within the myscript.py to define the selections. But this is very unhandy…
>
> Are there any ideas from any QGIS-Expert to solve my problem?
>
> If this cannot be solved in the current version of QGIS is one of the
> developers willing to get in contact with me to make an offer the
> implement this feature ?
>
> Thanks
>
> Peter
>
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info:https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe:https://lists.osgeo.org/mailman/listinfo/qgis-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220808/a56bb567/attachment.htm>
More information about the Qgis-user
mailing list