Skip to content

Instantly share code, notes, and snippets.

View pigreco's full-sized avatar
😎

Salvatore Fiandaca pigreco

😎
View GitHub Profile
@Korto19
Korto19 / Get_cat_color.py
Last active April 23, 2021 15:47
A QGIS field calculator expression to get the color of a categorized item
from qgis.gui import *
from qgis.utils import iface
@qgsfunction(args='auto', group='Custom')
def get_catg_color(value, feature, parent):
"""
Restituisce il colore RGBA dell'elemento categorizzato:
il campo in input e' quello utilizzato per la categorizzazione
Per i campi della categorizzazione numerici formattatarli opportunamente e
utilizzare la stessa espressione per catturarne il colore
@ThomasG77
ThomasG77 / README.md
Last active June 21, 2020 10:52
Script to write QGIS expressions on one page (easy to reference to help people on the web, text search from your browser) https://gist.githack.com/ThomasG77/0c6862fb2b6b3fc301ea994733688ea5/raw/99ecc5e6127e7238814da330a4d5d0b9fa2afe4e/qgis-3-12-expressions-single-page.html

Generate single page documentation for expressions

Why?

The goal was a single page documentation on expression

One approach could have been about using scripts/process_function_template.py and/or files in resources/function_help/json/. As there is no link between groups and functions documented in these json files, you need to look for the relation in the source src/core/expression/qgsexpressionfunction.cpp. You would also need to manage translations. FYI, all paths are relative to the root of the source code repo.

So, instead we've made the choice to use HTML generated doc for expressions from PyQGIS docs. It works for any languages