I want to create a color-relief and a hillshade with gdaldem and use them with mapnik. System: Ubuntu 14.04 LTS Server, gdal-bin 1.10.
Here are my steps:
-
Download all SRTM tiles from viewfinderpanoramas:
wget -r -np -l 1 -A zip http://www.viewfinderpanoramas.org/Coverage%20map%20viewfinderpanoramas_org3.htm
-
Unpack all zip files
-
Fill all remaining voids (creates out of every .hgt a .hgt.tif file)
for hgtfile in *.hgt;do gdal_fillnodata.py $hgtfile $hgtfile.tif; done
-
Merge all .tifs into one huge tif. This file will is the raw DEM with full resolution and the start for any further steps:
gdal_merge.py -n 32767 -co BIGTIFF=YES -co TILED=YES -co COMPRESS=LZW -co PREDICTOR=2 -o ../raw.tif *.hgt.tif
-
Convert the raw file into Mercator projection, interpolate and shrink e.g. to 1 km/pixel:
gdalwarp -co BIGTIFF=YES -co TILED=YES -co COMPRESS=LZW -co PREDICTOR=2 -t_srs "+proj=merc +ellps=sphere +R=6378137 +a=6378137 +units=m" -r bilinear -tr 1000 1000 raw.tif warp-1000.tif
-
Create color-relief with transparency (alpha channel) and lzw compression:
gdaldem color-relief -co COMPRESS=LZW -co PREDICTOR=2 -alpha warp-1000.tif relief.txt relief-1000.tif
-
Create hillshade
gdaldem hillshade -z 7 -compute_edges -co TILED=YES -co COMPRESS=JPEG warp-1000.tif hillshade-1000.tif
I get these output file sizes:
warp-5000.tif: 113 MB
warp-1000.tif: 606 MB
warp-500.tif: 1.7 GB
relief-5000.tif: 17 MB
(hdd was full!)
relief-1000.tif: 19 MB
relief-500.tif: >60 GB
hillshade-5000.tif: 2.7 MB
(hdd was full!)
hillshade-1000.tif: 75 MB
hillshade-500.tif: >70 GB
Why does the file size suddenly explode? Is there a way to create geotiffs with usable file size?
Please ask me if more you need more information about my approach.
Thanks in advance!