Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE model>
<Option type="Map">
<Option name="children" type="Map">
<Option name="native:aggregate_1" type="Map">
<Option name="active" value="true" type="bool"/>
<Option name="alg_config"/>
<Option name="alg_id" value="native:aggregate" type="QString"/>
<Option name="color" value="" type="QString"/>
<Option name="comment" type="Map">
<Option name="color" value="" type="QString"/>
from qgis.core import *
manager = QgsProject.instance().layoutManager()
base_path = os.path.join(QgsProject.instance().homePath())
layout = manager.layoutByName("Planbook")
exporter = QgsLayoutExporter(layout)
output_format = 'png'
exporter.exportToImage(layout.atlas(), base_path, output_format, QgsLayoutExporter.ImageExportSettings())
NyakudyaA /
Last active March 24, 2023 04:29
PyQGIS Implementation of generating raster statistics
import numpy as np
from PyQt5.QtCore import QFileInfo
import gdal
import osr
from PyQt5.QtGui import QColor
import processing
__author__ = 'admire'
from qgis.core import QgsRasterShader, QgsColorRampShader, QgsSingleBandPseudoColorRenderer, \
NyakudyaA / geoserver.jpeg
Last active June 30, 2020 16:49
GeoServer Favicon
NyakudyaA /
Created March 30, 2020 10:01
QGIS function to create dynamic map grids
Define new functions using @qgsfunction. feature and parent must always be the
last args. Use args=-1 to pass a list of values as arguments
from qgis.core import Qgis, QgsProject,QgsCoordinateTransform,QgsCoordinateReferenceSystem
from qgis.gui import *
from qgis.utils import qgsfunction, iface
def map_bounds(composer_title, map_id):
##Raster_layers=multiple raster
import datetime
import os
import re
from qgis.core import *
from qgis.core import (
NyakudyaA / Dockerfile
Created May 15, 2017 06:21 — forked from profjsb/Dockerfile
Refreshing Materialized Views in Postgres using Docker
# Dockerfile to run the cron jobs in root, including python/psycopg2
FROM alpine:edge
RUN apk add --no-cache -X py-psycopg2
COPY root /var/spool/cron/crontabs/root
CMD crond -l 2 -f