This file contains hidden or 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
PYTHONUNBUFFERED=1;QGIS_PREFIX_PATH=/home/etienne/dev/app/qgis-master;PYTHONPATH=/usr/lib/python3/dist-packages/ |
This file contains hidden or 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
@staticmethod | |
def debug_layer(context, layer: QgsMapLayer, name=None): | |
from qgis.core import QgsProcessingContext | |
if name: | |
layer.setName(name) | |
context.temporaryLayerStore().addMapLayer(layer) | |
context.addLayerToLoadOnCompletion( | |
layer.id(), | |
QgsProcessingContext.LayerDetails( |
This file contains hidden or 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
import sys | |
from qgis.core import QgsVectorLayer, QgsProject | |
from qgis.testing import unittest, start_app | |
start_app() | |
class TestTest(unittest.TestCase): |
This file contains hidden or 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
# Installer une version decente de virtualenv | |
> pip3 install virtualenv virtualenvwrapper | |
## A copier dans le .bashrc | |
# export WORKON_HOME=~/.virtualenvs/ | |
# mkdir -p $WORKON_HOME | |
# export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 | |
# source "/usr/local/bin/virtualenvwrapper.sh" | |
# | |
# S'assurer d'avoir ~/bin dans le path |
This file contains hidden or 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
# coding:utf-8 | |
from qgis.PyQt.QtCore import QUrl | |
from qgis.PyQt.QtNetwork import QNetworkRequest | |
from qgis.core import QgsNetworkAccessManager | |
url = 'http://lizmap.pn971.net/index.php/lizmap/service/?repository=portail&project=portail&SERVICE=WMTS&VERSION=1.0.0&REQUEST=GetCapabilities' | |
def urlCallFinished(reply): | |
print(reply.readAll()) |
This file contains hidden or 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
https://gis.stackexchange.com/questions/104453/why-result-of-merge-of-multiple-raster-is-so-big | |
for file in *.jp2; do | |
[ -e "$file" ] || continue | |
gdal_translate -of GTiff ${file} -co COMPRESS=JPEG -co bigtiff=yes ${file}.tiff | |
done | |
gdal_merge.py -ot Byte -of GTiff -o OUTPUT_block.tif -init "255 255 255" -co tiled=yes -co bigtiff=yes -co compress=jpeg --optfile /tmp/processing_3fad9415054b4e8fa4f0630b609149d9/mergeInputFiles.txt |
This file contains hidden or 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
DROP VIEW IF EXISTS liste_des_tables_sans_styles; | |
CREATE VIEW liste_des_tables_sans_styles AS | |
SELECT schemaname, tablename | |
FROM pg_catalog.pg_tables | |
WHERE schemaname NOT IN ('pg_catalog', 'public', 'information_schema') | |
EXCEPT | |
SELECT f_table_schema AS schemaname, f_table_name AS tablename FROM public.layer_styles; | |
DROP VIEW IF EXISTS liste_des_tables; | |
CREATE VIEW liste_des_tables AS |
This file contains hidden or 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
/usr/bin/Xvfb :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset | |
In Nginx: | |
fastcgi_param DISPLAY ":99"; |
This file contains hidden or 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
layer = iface.legendInterface().currentLayer () | |
root = QgsProject.instance().layerTreeRoot() | |
# Find the layer and set the custom property | |
layer_node = root.findLayer(layer.id()) | |
old_value = layer_node.customProperty("showFeatureCount") | |
layer_node.setCustomProperty("showFeatureCount", True) | |
layer_name = layer_node.layerName() | |