A tradução GeoTIFF para ENVI GDAL causa rotação

Aug 17 2020

Eu tenho um GeoTIFF ( você pode baixá-lo aqui ~ 16 MB) que desejo converter para ENVI raw . Estou usando este comando GDAL:
gdal_translate -ot UInt16 -scale -of ENVI -outsize 1025 1025 dgm1_32372_5680_2_nw.tif dgm1_32372_5680_2_nw.raw
O comando roda bem, mas dá um aviso:
Warning 1: Geotransform matrix has non rotational terms

Quando comparo os arquivos *.tif e *.raw no QGIS (3.14), o arquivo *.raw foi rotacionado de alguma forma.
Então eu fiz algumas googling e encontrei esta pergunta . Ok, vamos ver:
grep "map info" dgm1_32372_5680_2_nw.hdrdá:
map info = {Transverse Mercator, 1, 1, 32371999.5, 5679999.5, 1.95121951219512, 1.95121951219512, rotation=90}

Mas de acordo com esta postagem no blog, o bug foi corrigido com GDAL 2.20. Estou usando o GDAL 3.0.4. Então, alguém sabe qual pode ser o problema?

Respostas

1 user2856 Aug 17 2020 at 03:52

Você precisa gdalwarp para corrigir a rotação:

gdalwarp -of VRT dgm1_32372_5680_2_nw.tif dgm1_32372_5680_2_nw.vrt

Creating output file that is 2000P x 2000L.
Processing input file dgm1_32372_5680_2_nw.tif.

gdal_translate -ot UInt16 -scale -of ENVI -outsize 1025 1025 dgm1_32372_5680_2_nw.vrt dgm1_32372_5680_2_nw.raw

Input file size is 2000, 2000
0...10...20...30...40...50...60...70...80...90...100 - done.