Wednesday 20 January 2016

gdalwarp - gdal_warp with huge tif: integer overflow


I retrieved the SRTM 1" data and merged it in one huge tif. Now I want to warp it. It's working fine for low resolution (eg 5000, 1000, 500), but it doesn't for 90m resolution. I'm using this command:


gdalwarp -multi -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 90 90 src.tif dst.tif

And Gdal crashes with the following error:



Creating output file that is 445278P x 177313L. Processing input file raw.tif. 0ERROR 1: Integer overflow : nSrcXSize=1296001, nSrcYSize=417601




Is there something I can do, other than splitting my tif in several parts?


EDIT: I tried the solution proposed here: File size inflation normal with gdalwarp?


gdalwarp -tap -tr 30 30 -t_srs "+proj=merc +ellps=sphere +R=6378137 +a=6378137 +units=m" -of vrt raw.tif test.vrt
gdal_translate -co BIGTIFF=YES -co TILED=YES -co COMPRESS=LZW test.vrt warp.tif
gdaldem hillshade -z 1 -compute_edges -co BIGTIFF=YES -co TILED=YES -co COMPRESS=JPEG warp.tif hillshade.tif

While it indeed solves the integer overflow error, here's the result:


enter image description here


When using normal process (compressed gdalwarp + gdaldem hillshade), I get this (but I get the integer overflow error when running on my huge tif, here I ran it on a smaller file):



enter image description here


Is there a way to get the gdalwarp + gdal_translate + gdaldem solution to produce a result without the weird pattern?




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...