Skip to content

Instantly share code, notes, and snippets.

@ghtmtt
ghtmtt / cum_sum_datetime.py
Created Oct 15, 2019
takes a list of qdatetime objects and returns the difference from every object respect to the first one
View cum_sum_datetime.py
vl = iface.activeLayer()
s = 0
l = []
for i, j in enumerate(vl.getFeatures()):
l.append(j['time'].toPyDateTime())
ll = []
View modified.html
<head><meta charset="utf-8" /><script src="/home/matteo/.local/share/QGIS/QGIS3/profiles/matteo/python/plugins/DataPlotly/core/../jsscripts/polyfill.min.js"></script><script src="https://cdn.plot.ly/plotly-latest.min.js"></script></head><div> <div id="97e673f2-9241-4ef0-85f8-d0b67ecf5b2d" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}
;
if (document.getElementById("97e673f2-9241-4ef0-85f8-d0b67ecf5b2d")) {
Plotly.newPlot( '97e673f2-9241-4ef0-85f8-d0b67ecf5b2d', [ {
"customdata": ["so4"], "hoverinfo": "all", "ids": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "line": {
"dash": "solid", "width": 1
}
, "marker": {
"color": "rgb(142, 186, 217)", "colorbar": {
View original.html
<head><meta charset="utf-8" /><script src="/home/matteo/.local/share/QGIS/QGIS3/profiles/matteo/python/plugins/DataPlotly/core/../jsscripts/polyfill.min.js"></script><script src="/home/matteo/.local/share/QGIS/QGIS3/profiles/matteo/python/plugins/DataPlotly/core/../jsscripts/plotly-1.34.0.min.js"></script></head><div> <div id="97e673f2-9241-4ef0-85f8-d0b67ecf5b2d" class="plotly-graph-div" style="height:100%; width:100%;"></div> <script type="text/javascript"> window.PLOTLYENV=window.PLOTLYENV || {}
;
if (document.getElementById("97e673f2-9241-4ef0-85f8-d0b67ecf5b2d")) {
Plotly.newPlot( '97e673f2-9241-4ef0-85f8-d0b67ecf5b2d', [ {
"customdata": ["so4"], "hoverinfo": "all", "ids": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30], "line": {
"dash": "solid", "width": 1
}
, "marker": {
"color": "rgb(142, 186, 217)", "colorbar": {
View processing_metascript.py
# -*- coding: utf-8 -*-
"""
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
View layout
QGIS died on signal 11src/providers/wms/qgswmsprovider.cpp:871 : (draw) [14ms] [thread:0x556ade7f49a0] TILE CACHE total: 96 / 256
src/providers/wms/qgswmsprovider.cpp:897 : (readBlock) [0ms] [thread:0x556ade7f49a0] image height = 152 bytesPerLine = 888
src/providers/postgres/qgspostgresfeatureiterator.cpp:312 : (fetchFeature) [308ms] [thread:0x556ade7f49a0] Finished after 17 features
[New LWP 16769]
[New LWP 16770]
[New LWP 16771]
[New LWP 16772]
[New LWP 16773]
[New LWP 16775]
[New LWP 16776]
View crash
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
0x00007f37d9d0c7aa in __GI___waitpid (pid=5033, stat_loc=0x7fff203175ec, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
30 ../sysdeps/unix/sysv/linux/waitpid.c: No such file or directory.
[Current thread is 1 (Thread 0x7f37d0998e40 (LWP 5003))]
#0 0x00007f37d9d0c7aa in __GI___waitpid (pid=5033, stat_loc=0x7fff203175ec, options=0) at ../sysdeps/unix/sysv/linux/waitpid.c:30
resultvar = 18446744073709551104
sc_cancel_oldtype = 0
sc_ret = <optimized out>
#1 0x0000561bf4f541b0 in ?? ()
View viewshed.py
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication, QVariant
from qgis.core import (QgsProcessing,
QgsFeatureSink,
QgsField,
QgsFields,
QgsProcessingUtils,
QgsProcessingException,
QgsProcessingAlgorithm,
View processing.py
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from qgis.core import (QgsProcessing,
QgsFeatureSink,
QgsProcessingException,
QgsProcessingAlgorithm,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterVectorLayer,
View example.py
# -*- coding: utf-8 -*-
from PyQt5.QtCore import QCoreApplication
from qgis.core import (QgsProcessing,
QgsFeatureSink,
QgsProcessingAlgorithm,
QgsProcessingParameterFeatureSource,
QgsProcessingParameterFeatureSink)
import processing
View north.py
# -*- coding: utf-8 -*-
from operator import itemgetter
from PyQt5.QtCore import QCoreApplication
from qgis.core import (QgsFeatureSink,
QgsProcessing,
QgsProcessingAlgorithm,
QgsProcessingParameterFeatureSink,
QgsProcessingParameterNumber,