This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis.core import * | |
from qgis.gui import * | |
from qgis.utils import iface | |
@qgsfunction(args='auto', group='Custom') | |
def get_cat_param( vlayer, cat_field, param, feature, parent): | |
""" | |
Dato un layer <b>categorizzato con riempimento semplice</b> restituisce i parametri di impostazione | |
<ol> | |
<li>parametro: <b>layer</b></li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Algorithm for QGIS console | |
# first select group | |
# repeat to reverse order | |
from collections import OrderedDict | |
root = QgsProject.instance().layerTreeRoot() | |
group_sel = iface.layerTreeView().selectedNodes() | |
group = root.findGroup(group_sel[0].name()) | |
if root.findGroup(group_sel[0].name()): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Korto19 2022 | |
# Script da console | |
# Lista su un csv dei gruppi e delle funzioni del field calc | |
# Stampa in console gruppo e n espressioni contenute | |
# File csv risultante: impostare nome e percorso,con permesso di scrittura, alla riga 31 | |
# Korto19 2022 | |
from qgis.core import QgsExpression | |
import csv |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ORDINAMENTO PER TIPO E PER NOME ASCENDENTE | |
# se si vuole decrescente porre reverse=True alla linea 57 | |
# crea i gruppi se non esistono | |
# conta quanti layer ha scansionato e di quale tipo | |
# ricordarsi che è un ordinamento alfabetico !! | |
# python 3 - Update 30.01.2020 | |
import datetime | |
current_time = datetime.datetime.now() | |
print ("Time now at greenwich meridian is :" , current_time) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis.core import * | |
from qgis.gui import * | |
from PyQt5.QtGui import QImage, QImageReader | |
@qgsfunction(args='auto', group='Custom', referenced_columns=[]) | |
def get_blob_sizes(img_blob, feature, parent): | |
""" | |
Calculate blob image dimension (W x H) | |
<h2>Example usage:</h2> | |
<ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Korto19 2021 | |
from qgis.core import * | |
from qgis.gui import * | |
import math | |
@qgsfunction(args='auto', group='Svg') | |
def svg_Pie(value, donut, pcol, flipper, legenda, feature, parent): | |
""" | |
Genera un grafico a torta inseribile in una cornice HTML nel compositore di stampe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from qgis.core import * | |
from qgis.gui import * | |
mem = 'NULL' | |
@qgsfunction(args='auto', group='Custom', handlesnull=True) | |
def fill_down(value1, feature, parent): | |
""" | |
Restituisce un valore dal campo specificato, | |
dove il valore del campo della riga precedente | |
viene propagato ai campi con valori Null successivi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |