Skip to content

Instantly share code, notes, and snippets.

@luipir
luipir / azure_uamqp_lock_token_error.log
Created September 20, 2019 09:30
uamqp debug messages about lock token nto trasmitetd in a specific azure queue
2019-09-20 11:21:26,122 uamqp.receiver INFO Received Link detach event: b'amqp:link:detach-forced'
Link: b'receiver-link-5cb0a0ba-bbab-411c-819f-110bbea40add'
Description: b"The link 'G26:34611229:receiver-link-5cb0a0ba-bbab-411c-819f-110bbea40add' is force detached by the broker due to errors occurred in consumer(link14926311). Detach origin: InnerMessageReceiver was closed. TrackingId:b6bf33280011000100e3c1e75d849a0c_G26_B8, SystemTracker:primare-desa-service-bus:Topic:primare_desa_topic_initplanification|proyestegal_initplanification_suscriber, Timestamp:2019-09-20T09:21:26"
Details: None
Retryable: True
Connection: b'SBReceiver-63f1aa5a-3d35-4049-95e8-47703b3a93aa'
2019-09-20 11:21:26,122 uamqp.c_uamqp DEBUG Deallocating cError
2019-09-20 11:21:26,123 uamqp.receiver INFO Message receiver b'receiver-link-5cb0a0ba-bbab-411c-819f-110bbea40add' state changed from <MessageReceiverState.Open: 2> to <MessageReceiverState.Error: 4> on connection: b'SBReceiver-63f1aa5a-3d35-4049-95e8-47703b3a93aa'
2019-
@luipir
luipir / pure_python_and_gdal_metadata_parser.py
Last active August 29, 2019 15:21
Pure python and GDAL metadata extractor
from xml.etree import cElementTree as ElementTree
from osgeo import gdal
imgpath = '???????????<put the image path here>????????????'
###############################################
# XML to dict parsing code get from:
# https://stackoverflow.com/questions/2148119/how-to-convert-an-xml-string-to-a-dictionary
class XmlListConfig(list):
def __init__(self, aList):
@luipir
luipir / camera_calculator.py
Last active February 29, 2024 16:45
Camera Footprint Calculator
"""
***************************************************************************
camera_calculator.py
---------------------
Date : August 2019
Copyright : (C) 2019 by Luigi Pirelli
Email : luipir at gmail dot com
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
@luipir
luipir / gdal_ecw.sh
Created April 16, 2019 10:43 — forked from 1papaya/gdal_ecw.sh
Install GDAL 2.3 with ECW support on Ubuntu 18.04
#!/bin/bash
##
## Tested on: Ubuntu 18.04 & ECW 5.4 & GDAL 2.3.1
##
## Download the ERDAS ECW JP2 SDK v5.4 Linux
## https://download.hexagongeospatial.com/downloads/ecw/erdas-ecw-jp2-sdk-v5-4-linux
## Download GDAL v2.3 Source (ex. 2.3.1)
@luipir
luipir / ctest -V -R PyQgsDBManagerGpkg
Created November 10, 2017 16:04
Error eceuting test PyQgsDBManagerGpkg with qgis master 46ec158
16:46 $ ctest -V -R PyQgsDBManagerGpkg
UpdateCTestConfiguration from :/home/ginetto/PROGRAMMING/QGIS/QGIS-master/build/DartConfiguration.tcl
Parse Config file:/home/ginetto/PROGRAMMING/QGIS/QGIS-master/build/DartConfiguration.tcl
Add coverage exclude regular expressions.
Add coverage exclude: /CMakeFiles/CMakeTmp/
Add coverage exclude: .*/Testing/Utilities/.*
Add coverage exclude: .*/Utilities/.*
Add coverage exclude: .*/Code/Wrappers/SWIG/otbApplicationPYTHON_wrap.*
Add coverage exclude: .*/Code/Wrappers/SWIG/otbApplicationJAVA_wrap.*
SetCTestConfiguration:CMakeCommand:/usr/bin/cmake
@luipir
luipir / gist:2cd9f01b1d2e881c9f479f55069600ce
Created May 11, 2016 13:20
qgis custom expression to check if feature is selected
"""
Template function file. Define new functions using @qgsfunction.
When using args="auto" you may define a new variable for each value for the function.
feature and parent must always be the last args.
To pass a any number of args into a function use args=-1 the first
variable will then be a list of values.
"""
from qgis.core import *
from qgis.gui import *
@luipir
luipir / gist:dac9f2b67bb051e47767
Created November 23, 2015 08:58
Test compilation error on testqgsfontutils.cpp
Building CXX object tests/src/core/CMakeFiles/qgis_graduatedsymbolrenderertest.dir/testqgsgraduatedsymbolrenderer.cpp.o
Building CXX object tests/src/core/CMakeFiles/qgis_histogramtest.dir/testqgshistogram.cpp.o
/mnt/data/PROGRAMMING/QGIS-2.0-master/tests/src/core/testqgsfontutils.cpp:151:32: fatal error: testqgsfontutils.moc: No such file or directory
compilation terminated.
tests/src/core/CMakeFiles/qgis_fontutils.dir/build.make:54: recipe for target 'tests/src/core/CMakeFiles/qgis_fontutils.dir/testqgsfontutils.cpp.o' failed
make[2]: *** [tests/src/core/CMakeFiles/qgis_fontutils.dir/testqgsfontutils.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
[ 82%] Building CXX object tests/src/core/CMakeFiles/qgis_histogramtest.dir/qgscompositionchecker.cpp.o
CMakeFiles/Makefile2:12117: recipe for target 'tests/src/core/CMakeFiles/qgis_fontutils.dir/all' failed
make[1]: *** [tests/src/core/CMakeFiles/qgis_fontutils.dir/all] Error 2
@luipir
luipir / gist:7b873111a5802c21c138
Created November 23, 2015 08:53
Compilation error appeared only first make
[ 35%] Building CXX object src/gui/CMakeFiles/qgis_gui.dir/raster/qgsrasterminmaxwidget.cpp.o
[ 35%] Building CXX object src/analysis/CMakeFiles/qgis_analysis.dir/vector/qgszonalstatistics.cpp.o
In file included from /mnt/data/PROGRAMMING/QGIS-2.0-master/src/gui/raster/qgsrasterminmaxwidget.cpp:22:0:
/mnt/data/PROGRAMMING/QGIS-2.0-master/src/gui/raster/qgsrasterminmaxwidget.h:21:42: fatal error: ui_qgsrasterminmaxwidgetbase.h: No such file or directory
compilation terminated.
src/gui/CMakeFiles/qgis_gui.dir/build.make:1398: recipe for target 'src/gui/CMakeFiles/qgis_gui.dir/raster/qgsrasterminmaxwidget.cpp.o' failed
make[2]: *** [src/gui/CMakeFiles/qgis_gui.dir/raster/qgsrasterminmaxwidget.cpp.o] Error 1
CMakeFiles/Makefile2:1322: recipe for target 'src/gui/CMakeFiles/qgis_gui.dir/all' failed
make[1]: *** [src/gui/CMakeFiles/qgis_gui.dir/all] Error 2
[ 35%] Building CXX object src/analysis/CMakeFiles/qgis_analysis.dir/vector/qgsoverlayanalyzer.cpp.o
#0 0x00007ffff4e97fca in QgsVectorLayerJoinBuffer::clone (this=0x0) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerjoinbuffer.cpp:385
#1 0x00007ffff4e8ca70 in QgsVectorLayerFeatureSource::QgsVectorLayerFeatureSource (this=0x1255b70, layer=0x1253dd0) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayerfeatureiterator.cpp:30
#2 0x00007ffff4e669be in QgsVectorLayer::getFeatures (this=0x1253dd0, request=...) at /home/ginetto/PROGRAMMING/QGIS-2.0-master/src/core/qgsvectorlayer.cpp:946
#3 0x00007ffff6049b65 in meth_QgsVectorLayer_getFeatures (sipSelf=<QgsVectorLayer at remote 0xfdb560>, sipArgs=(), sipKwds=0x0)
at /home/ginetto/PROGRAMMING/QGIS-2.0-master/build/python/core/sip_corepart2.cpp:143806
#4 0x00000000004aa4de in call_function (oparg=<optimized out>, pp_stack=0x7fffffffddf0) at ../Python/ceval.c:4021
#5 PyEval_EvalFrameEx (f=f@entry=Frame 0x99ce70, for file __main__.py, line 58, in <module> (), throwflag=throwflag@entry=0) at ../Python/ceval.c:2666
#6 0x00000
@luipir
luipir / gist:fcbc318304944962dfec
Last active August 29, 2015 14:11
mutual exclusivity in QgsFeatureRequest
myVector = iface.activeLayer() # alaska.shp in qgis_sample_data
# iteration getting only selected features
rect = QgsRectangle( 1223070.695, 2293653.357 , 9046974.211, 4184988.662)
request = QgsFeatureRequest()
request.setSubsetOfAttributes([0, 2])
request.setFilterExpression('"AREA_MI" > 1000')
request.setFilterRect( rect )