[QGIS-Developer] Expression Functions: Where are they used in QGIS Desktop? Which ones won't work "outside"?

Stefan Keller sfkeller at gmail.com
Sun May 7 13:57:41 PDT 2017


Good question! According to the workshop registrations quite some
other attendees seem to be interested too at least to know more about
this :-)

In the workshop we demonstrate custom Expression Functions (EFns) from
Nathan's plugin https://github.com/NathanW2/qgsexpressionsplus which
contains some useful functions missing in core like max_incremented()
aka auto-increment, hstore_get_key for fields with key-value pairs,
etc. Then we show get_address() in order to reverse geocode lat/lon to
an address,

Then think for example about a custom EFn (not yet implemented):
* env() which returns system environment variables;
* nullif() which turns empty strings to NULL (with build-in condition);
* which generates a fuzzy or scribbled boundary on the fly.
* etc.

:Stefan

2017-05-07 21:51 GMT+02:00 Andreas Neumann <a.neumann at carto.net>:
> Hi Stefan,
>
> Expressions also work in QGIS cloud (which is QGIS server based) - but
> Python based expressions don't work in QGIS server.
>
> I have to say, however, that the QGIS core expressions are already quite
> powerful and I don't often have the need to create my own custom Python
> based expressions. I just recently had to use them - but that is the fist
> time after many years ;-)
>
> What is your reason that you have to use Python based expression as opposed
> to the core built-in expressions?
>
> Andreas
>
>
>
> On 07.05.2017 17:01, Stefan Keller wrote:
>>
>> Hi,
>>
>> Tomorrow I'll be giving a Workshop about "Easy Programming QGIS with
>> Python for custom Expression Functions (EFns)" [1].
>>
>> Question 1: Below you'll find an initial list I compiled where EFns
>> are used in QGIS Desktop. => Did I miss an occurrence?
>>
>> Question 2: I tried to make a categorization for several reasons. One
>> reason for this is to realize that a EFn may not work outside QGIS
>> Desktop. Style-related EFns for example won't work currently in
>> qgis2web or QGISCloud. => Any comments?
>>
>> :Stefan
>>
>> [1] https://2017.geopython.net/#schedule
>>
>> List where EFns are used in QGIS (probably incomplete):
>>
>> "Server-side" / data-related:
>> * "Select features using an expression" (Layer property).
>> * "Filtering features" while loading from source. Switch to the form
>> view in the attribute table (button on bottom right corner) > click on
>> 'Show All Features' (bottom left) and select 'Advanced Filter
>> (Expression)'.
>> * "Layer > Properties > Tab Fields" in Button "Text Edit" in Default-
>> and in Constraints-Field.
>> * "Layer > Properties > Tab Style" in "Label with".
>> * "Field Calculator" to defining new or virtual fields (Layer property).
>> * "Conditional formatting" in the attribute table (Create a new rule
>> and set the condition to the output of a custom EFn).
>> Analysis-related:
>> * "Statistical Summary" Panel (Layer property).
>> * "Atlas Generation" in the Print Composer. Project > Print Composer >
>> Check 'generate an atlas' > Set CEF based values for page name, filter
>> and output filename.
>> "Client-side" / style-related:
>> * "Map Tip" tool (Layer property).
>> * "Rule based labeling". Layer Properties > Labels > Select Rule based
>> labeling from the drop-down menu > Click on the '+' button and add a
>> CEF based filter (... button).
>> * Part of "Geometry generator" in "Style > Symbol Layer Type"
>> _______________________________________________
>> 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
>
>
> _______________________________________________
> 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


More information about the QGIS-Developer mailing list