PyQGIS Documentation - Linfiniti Geo Blog
PyQGIS Documentation - Linfiniti Geo Blog
PyQGIS Documentation - Linfiniti Geo Blog
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
CHAPTER<br />
NINE<br />
EXPRESSIONS, FILTERING AND<br />
CALCULATING VALUES<br />
QGIS has some support for parsing of SQL-like expressions. Only a small subset of SQL syntax is supported. The<br />
expressions can be evaluated either as boolean predicates (returning True or False) or as functions (returning a scalar<br />
value).<br />
Three basic types are supported:<br />
• number — both whole numbers and decimal numbers, e.g. 123, 3.14<br />
• string — they have to be enclosed in single quotes: ’hello world’<br />
• column reference — when evaluating, the reference is substituted with the actual value of the field. The names<br />
are not escaped.<br />
The following operations are available:<br />
• arithmetic operators: +, -, *, /, ^<br />
• parentheses: for enforcing the operator precedence: (1 + 1) * 3<br />
• unary plus and minus: -12, +5<br />
• mathematical functions: sqrt, sin, cos, tan, asin, acos, atan<br />
• geometry functions: $area, $length<br />
• conversion functions: to int, to real, to string<br />
And following predicates are supported:<br />
• comparison: =, !=, >, >=,