cmosig
cmosig

Reputation: 1317

Save CRS in .tif instead of .aux.xml when reprojecting `.tif` using `gdalwarp`

I am using gdalwarp -t_srs EPSG:8857 -r bilinear -wo NUM_THREADS=20 -multi in.tif out.tif to change the CRS of in.tif. This returns the desired out.tif file but also out.tif.aux.xml which contains the CRS information. This means if I delete out.tif.aux.xml the CRS information is lost and gdalinfo out.tif does not show the CRS information anymore.

Is there a way to save specify that the CRS is saved in out.tif? This must be somehow possible because in.tif also contains its CRS information.

For some reason I get the out.tif with CRS on a different machine with the exact same command. I wonder what to look for.

EDIT: Everything works fine with EPSG:4326. What is the issue with EPSG:8857?

Upvotes: 0

Views: 253

Answers (1)

Criminal_Affair_At_SO
Criminal_Affair_At_SO

Reputation: 3443

The XML gets to store everything that GDAL cannot store in the output format because it does not support it.

GeoTIFF supports having a projection, but not every possible way to encode it. Is there anything special about the projection in the input file? Also try the latest GDAL, I just tried with 3.4.1 and it can write EPSG:8857 directly in the GeoTIFF for sure. Also try setting the environment variable GDAL_PAM_ENABLED to NO.

Upvotes: 0

Related Questions