Skip to content

Instantly share code, notes, and snippets.

View palmerj's full-sized avatar

Jeremy Palmer palmerj

  • Toitū The Whenua Land Information New Zealand
  • Wellington, New Zealand
View GitHub Profile
#!/bin/bash
FILE_IN=
file_name=$( basename $FILE_IN | sed 's/.tif//' )
output_dir=
div
function gdal_extent_gdalwarp_te() {
@palmerj
palmerj / NZTM2000_EPSG2193.png
Last active June 2, 2020 02:33
NZTM2000 EPSG:2193
NZTM2000_EPSG2193.png
@palmerj
palmerj / gdal_py_install.sh
Created March 3, 2020 08:52
Install GDAL python binding using MacOSX framework
wget https://files.pythonhosted.org/packages/dc/d5/90339b48bdcabc76124eaa058a32d796963a05624eb418ed5ea5af7db9fa/GDAL-2.4.2.tar.gz
tar -xpf GDAL-2.4.2.tar.gz
cd GDAL-2.4.2
python setup.py build_ext -I/Library/Frameworks/GDAL.framework/Versions/2.4/Headers -L/Library/Frameworks/GDAL.framework/Versions/2.4/unix/lib --gdal-config /Library/Frameworks/GDAL.framework/Versions/2.4/unix/bin/gdal-config
python setup.py build
python setup.py install
@palmerj
palmerj / download_nz_data.sh
Last active May 26, 2019 10:20
Download LINZ parcels data using LDS Export API with bash script
#!/bin/bash
# Quick script to download LDS data and prepare it for loading into
# a POSTGIS Database
endpoint="https://data.linz.govt.nz/services/api/v1/exports/"
download_file="nz-data.zip"
poll_interval=10
if [ -z "$LDS_API_KEY" ]
@palmerj
palmerj / create_rgb_bigtiff_cog.sh
Last active April 6, 2022 20:42
Create RGBA COG with GDAL > 2.3
#!/bin/bash
set -Eeuo pipefail
BLOCKSIZE=256
OVERVIEW_BLOCKSIZE=256
MIN_OVERVIEW_SIZE=256
KEEP_TEMP=0
MOSAIC_VRT="mosaic.vrt"
MOSAIC_RGB_VRT="mosaicrgb.vrt"
@palmerj
palmerj / rgb_bigtiff_cogs_notes.md
Last active August 16, 2023 17:33
Creating BigTiff COGS for raster RGB photos from a tile mosaic directory using GDAL

Creating a Cloud Optimised Geotiffs (COGs) for raster photo imagery

This process outlines the process for creating Cloud Optimised Geotiffs suitable for hosting in services such as AWS S3. COGs enables more efficient workflows use cases such as fast access from Functions as a Services (E.g AWS Lambda), or comsumption into client desktop GIS systems (e.g QGIS). For more details on COGs please see https://www.cogeo.org/in-depth.html

1. Create a mosaic

GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
CSW: http://geodata.govt.nz/geonetwork/srv/eng/csw?SERVICE=CSW&REQUEST=GetCapabilities
HTTP: Fetch(http://geodata.govt.nz/geonetwork/srv/eng/csw?SERVICE=CSW&REQUEST=GetCapabilities)
HTTP: libcurl/7.54.0 LibreSSL/2.6.4 zlib/1.2.11 nghttp2/1.24.1
HTTP: GDAL was built against curl 7.43.0, but is running against 7.54.0.
GDAL: GDALOpen(CSW:http://geodata.govt.nz/geonetwork/srv/eng/csw, this=0x7fc8c7500d40) succeeds as CSW.
GDAL: QuietDelete(geodata.govt.nz.csv) invoking Delete()
GDAL: GDALDriver::Create(CSV,geodata.govt.nz.csv,0,0,0,Unknown,0x0)
@palmerj
palmerj / error.log
Created October 10, 2018 04:44
GDAL brew install error
2018-10-10 16:45:50 +1300
make
(cd port; /Applications/Xcode.app/Contents/Developer/usr/bin/make)
(cd gcore; /Applications/Xcode.app/Contents/Developer/usr/bin/make generate_gdal_version_h)
rm -f gdal.pc
echo 'CONFIG_VERSION='`cat ./VERSION`'' >> gdal.pc
/bin/sh /private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/libtool --mode=compile --silent --tag=CXX clang++ -std=c++11 -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/port -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/gcore -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/alg -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/ogr -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/ogr/ogrsf_frmts -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/gnm -I/private/tmp/gdal-20181010-68482-1e3e6pj/gdal-2.3.1/apps -Wold-style-cast -DHAVE_AVX_AT_COMPILE_TIME -DHAVE_SSSE3_AT_COMPILE_TIME -DHAVE_SSE_AT_COMPILE_TIME -g -O2 -Wall -Wextra -Winit-self -Wunused-parameter -Wformat -Werror=format-security -Wno-format-nonliteral -Wshorten-64-to
@palmerj
palmerj / xbox_button_names.md
Last active February 22, 2024 14:43
Xbox Controller Button Names and Layout

Buttons

  • RSB == Right Stick Button
  • LSB == Left Stick Button
  • RB == Right Bumper
  • RT == Right Trigger
  • LB == Left Bumper
  • LT == Left Trigger
  • Y == Y Button (Top)
  • A == A Button (Bottom)
@palmerj
palmerj / qgis3_profile.png
Last active February 20, 2018 20:14
QGIS 3.0 Profile
qgis3_profile.png