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
@palmerj
palmerj / TileMatrixSet.xml
Created February 5, 2018 00:08
Geoserver WMTS capabilities TileMatrix for NZTM2000
<TileMatrixSet>
<ows:Identifier>NZTM2000</ows:Identifier>
<ows:SupportedCRS>urn:ogc:def:crs:EPSG::2193</ows:SupportedCRS>
<TileMatrix>
<ows:Identifier>0</ows:Identifier>
<ScaleDenominator>3.2000000000000004E7</ScaleDenominator>
<TopLeftCorner>-1000000.0 1.226204E7</TopLeftCorner>
<TileWidth>256</TileWidth>
<TileHeight>256</TileHeight>
<MatrixWidth>2</MatrixWidth>
@palmerj
palmerj / parcels.vrt
Created February 18, 2018 23:35
GDAL mbtiles vector tile VRT
<OGRVRTDataSource>
<Metadata domain="IMAGE_STRUCTURE">
<MDI key="INTERLEAVE">PIXEL</MDI>
</Metadata>
<Metadata>
<MDI key="name">parcels</MDI>
<MDI key="format">pbf</MDI>
<MDI key="center">174.6325388,-36.9883061,0</MDI>
<MDI key="ZOOM_LEVEL">14</MDI>
<MDI key="bounds">174.1821636,-37.3637475,175.0829141,-36.6128647</MDI>
@palmerj
palmerj / mvt_qgis.md
Last active February 20, 2018 02:03
View Vector Tiles in QGIS using GDAL/OGR 2.3

Create mapbox vectors using OGR

Get NZ parcels data over Auckland region in SHP: https://data.linz.govt.nz/x/CLzEZU

Generate vector tiles

ogr2ogr -f MBTILES parcels.mbtiles nz-primary-parcels.shp -dsco MAXZOOM=14
@palmerj
palmerj / qgis3_profile.png
Last active February 20, 2018 20:14
QGIS 3.0 Profile
qgis3_profile.png
@palmerj
palmerj / xbox_button_names.md
Last active April 17, 2025 09:08
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 / 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
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 / 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

@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 / 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" ]