Skip to content

Instantly share code, notes, and snippets.

@simonpoole
Last active September 6, 2018 10:35
Show Gist options
  • Save simonpoole/4eb54d9c0c88b296110a8e8b1de4ff08 to your computer and use it in GitHub Desktop.
Save simonpoole/4eb54d9c0c88b296110a8e8b1de4ff08 to your computer and use it in GitHub Desktop.
Tile AGIS imagery
The original imagery has 4 bands (RGB and NIR) and 16bit values
Build the virtual image using the RGB bands
gdalbuildvrt -a_srs EPSG:21781 -allow_projection_difference -b 1 -b 2 -b 3 -input_file_list tifs16.list 2016rgb.vrt
Translate from 16 bit to 8 bit values (note this is fairly slow)
gdal_translate -scale -of VRT -ot Byte 2016rgb.vrt 2016rgb8.vrt
https://github.com/GitHubRGI/geopackage-python has the parallel gdal2tiles version
gdal2tiles_parallel.py -s EPSG:21781 -z 8-19 -p mercator -f PNG --processes 4 2016rgb8.vrt
... wait a long time (on a 6 core xeon machine using --processes 6 ~47h down to zoom 20 which however doesn't make sense for 25cm/pixel imagery, which takes 28 hours to zoom 19) ...
generate mbtiles file:
set SQLITE_TMPDIR to a location that has at least enough space for a full copy of the mbtiles file (vacuum needs this)
https://github.com/mapbox/mbutil
mb-util --image_format=png --scheme=tms 2016rgb8/ /server/agis_2016.mbtiles
Takes roughly 20 hours (but slow disks).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment