Skip to content

Instantly share code, notes, and snippets.

View thbaumann's full-sized avatar

Thomas Baumann @work thbaumann

View GitHub Profile
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@thbaumann
thbaumann / filerotator.py
Created January 30, 2019 07:09 — forked from adejones/filerotator.py
Python class and utility for file rotation. Configurable daily, weekly and monthly retention; can use hard links to save space; supports `argparse` config files.
#!/usr/bin/env python3
# vim: ft=python ts=4 sw=4 expandtab
#
# Copyright (c) 2013 Reed Kraft-Murphy <reed@reedmurphy.net>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
@thbaumann
thbaumann / pyqgis_common_functions_examples.py
Created February 20, 2019 13:42
examples for pyqgis common functions
Examples for some pyqgis common functions.
Some may be outdated as things can be done easier in qgis3 now but they should just be an example
for some functions that were use to make life easier during the development of QGIS plugins:
examples from https://github.com/boundlessgeo/lib-qgis-commons/blob/master/qgiscommons2/layers.py
def load_layer(filename, name = None):
'''
Tries to load a layer from the given file
:param filename: the path to the file to load.
@thbaumann
thbaumann / tomtom_bandit_mp4.metadata
Created March 4, 2019 07:55
metadata extracted from tomtom bandit mp4 file
ExifToolVersion = 10.10
FileName = 2019_02_steffen_MOV_0124.MP4
Directory = .
FileSize = 2518372718
FileModifyDate = 1551173630
FileAccessDate = 1551197571
FileInodeChangeDate = 1551337413
FilePermissions = 33261
FileType = MP4
FileTypeExtension = MP4
@thbaumann
thbaumann / qgis_repository_broken_links
Created March 12, 2019 08:33
qgis_repository_broken_links.txt
@thbaumann
thbaumann / find_mac_os_folder_in_qgis_plugins.py
Last active March 12, 2019 14:41
Find macosx folder in qgis plugin zipfiles
# encoding: utf-8
from __future__ import unicode_literals
#-----------------------------------------------------------
# Copyright (C) 2019 Thomas Baumann
#-----------------------------------------------------------
# Licensed under the terms of GNU GPL 2
#
# 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
@thbaumann
thbaumann / CompareCompress.py
Created March 13, 2019 13:51 — forked from jevans5489/CompareCompress.py
Compares lossless GDAL Compression on a sample image.
# ----------------------------------------------------------------------------------------------------------------------
# Name: CompareCompression.py
# Py-Version: 3.x.x
# Purpose: Takes a sample GeoTIFF and writes a table to the command line describing the
# file size, read speed, and write speed of each GDAL compression. You can use this
# tool to decide how to best compress a single image, or a collection of images.
#
# Notes: The Python interpreter and GDAL must be accessible by cmd. The easiest way to do
# this by using the python installation included with ArcGIS Pro 2.3.x and later.
# This installation has the GDAL site package and binaries already configured. Add
@thbaumann
thbaumann / wfs_to_local_file.bat
Last active December 28, 2022 14:59
download wfs to shapefile or gepacke with ogr2ogr
@echo off
set OSGEO4W_ROOT=C:\OSGeo4W64
set basis_url="https://www.geodatenportal.sachsen-anhalt.de/gfds/ws/wfs/942f5d74-6c2b-263a/GDI-LSA_Schutzgebiete/ows.wfs?REQUEST=GetCapabilities&SERVICE=WFS"
set layer="sg:lau_br_lsa"
call "%OSGEO4W_ROOT%\bin\o4w_env.bat"
@thbaumann
thbaumann / GTiff_compression_benchmark.py
Created January 27, 2020 12:51 — forked from kr-stn/GTiff_compression_benchmark.py
Benchmark filesize and read/ write times for various GeoTiff compression algorithms
__author__ = 'kersten.clauss'
"""Benchmark different GeoTiff compression algorithms.
Usage: GTiff_compression_benchmark.py some_geo.tif
Requires the GDAL tools to be present and executable from the command line of your system.
This script will take a GeoTiff as input and create copies with different compression algorithms from it.
It measures the filesize, compression and decompression times and returns them as a table.
@echo off
call "%~dp0\o4w_env.bat"
call qt5_env.bat
call py3_env.bat
@echo off
path %OSGEO4W_ROOT%\apps\qgis\bin;%PATH%
set QGIS_PREFIX_PATH=%OSGEO4W_ROOT:\=/%/apps/qgis
set GDAL_FILENAME_IS_UTF8=YES
rem Set VSI cache to be used as buffer, see #6448
set VSI_CACHE=TRUE