Skip to content

Instantly share code, notes, and snippets.

@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

import os
import sys
outdir = os.path.abspath(os.path.join(os.path.dirname(__file__), 'output'))
if not os.path.exists(outdir):
os.mkdir(outdir)
input_elevation = "dem.img"
gisbase = os.environ['GISBASE'] = "/usr/local/grass-7.0.0svn"
@seberg
seberg / rolling_window.py
Created October 10, 2012 14:38
Multidimensional rolling_window for numpy
def rolling_window(array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True):
"""Create a view of `array` which for every point gives the n-dimensional
neighbourhood of size window. New dimensions are added at the end of
`array` or after the corresponding original dimension.
Parameters
----------
array : array_like
Array to which the rolling window is applied.
window : int or tuple
@erussell
erussell / .gitignore
Created July 25, 2012 14:59
Python script to be run daily to maintain an ArcGIS mosaic dataset of Growing Degree Days, using tempertaure data from the Historical Climate Network
/data
/mosaic.gdb
/scratch.gdb