[Qgis-user] Python Scripts (Boolean) in QGIS 3

Stefan Giese (WhereGroup) stefan.giese at wheregroup.com
Tue Mar 12 06:05:15 PDT 2019


Hi Herbert,
with processing scripts ist has defintitly changed a lot. The thing is, 
that in QGIS 2.18 it was python but mixed with some none python, like 
the parameter with the double pound sign...like ##my_parameter=boolean

so a good starting point is the blog from Anita Graser, since the 
documetation on qgis.org isn't that actual at the moment: 
https://anitagraser.com/2018/03/25/processing-script-template-for-qgis3/

you can also start with the template directly in QGIS selecting "New 
script from template.." in the processing toolbox top, where the python 
icon is...

Hope this helps a bit
Stefan

---
Mit freundlichen Grüßen
Stefan Giese

Projektleiter/Consultant
****************************************************************************
FOSS Academy Kompaktkurs "Winterschule 2019"
Grundwissen zum Aufbau von Geodateninfrastrukturen mit 
Open-Source-Software
https://foss-academy.com/kompaktkurse
****************************************************************************
WhereGroup GmbH & Co. KG
Schwimmbadstr. 2
79100 Freiburg
Germany

Fon: +49 (0)761 / 519 102 - 61
Fax: +49 (0)761 / 519 102 - 11

stefan.giese at wheregroup.com
www.wheregroup.com
Amtsgericht Bonn, HRA 6788
-------------------------------
Komplementärin:
WhereGroup Verwaltungs GmbH
vertreten durch:
Olaf Knopp, Peter Stamm
-------------------------------

Am 2019-03-12 13:48, schrieb Herbert Lincon:
> Hello everyone,
> 
>  I have a script in QGIS 2.18 to receive the information from 4
> boolean options as simple as that
> 
>  ##formula_1=boolean
> 
> ##formula_2=boolean
> 
> ##formula_3=boolean
> 
> ##formula_4=boolean
> 
> ##result=output string
> 
> if formula_1 == True:
> 
>     result= 1
> 
> elif formula_2 == True:
> 
>     result= 2
> 
> elif formula_3 == True:
> 
>     result= 3
> 
> elif formula_4 == True:
> 
>     result= 4
> 
> else:
>      result= 5
> 
>  the problem is, this type of script doesn´t work in QGIS 3, and I´m
> a newbie in Python,
>  could someone translate that to the new method?
> 
>  it´ll help me even begin to understand python 3
> 
>  Thanks
>  Herbert Lincon
> _______________________________________________
> 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


More information about the Qgis-user mailing list