# How to reproject a raster file in QGIS with datum transformation?

I want to reproject a tiff raster file from projection A (ETRS89/UTM Zone 32) to projection B (DHDN/Gauss-Kruger zone 2). The two projections have a different datum so I have to use a datum transformation (NTv2 BETa2007 in my case). I want to create a new raster file with projection B because I want to use it in another software. So reprojection on-the-fly is not what I need.

I have tried Raster > Transform (or similar - I do not know the English menu) but I can not see how to define a datum transformation here.

How can I do a permanent reprojection of a raster file in Qgis with a datum transformation?

-

Gdalwarp is the tool to reproject, you find it in Qgis under Raster->Projektionen->Transformieren or standalone in OSGEO4W.

Basic command is

gdalwarp -s_srs EPSG:25832 -t_srs "+proj=tmerc +lat_0=0 +lon_0=6 +x_0=2500000 +y_0=0 +k=1.000000 +ellps=bessel +units=m +nadgrids=./BETA2007.gsb +wktext" input.tif output.tif


BETA2007.gsb should be in the same folder, or use absolute path to it.

In Qgis, select the loaded tif as input, and its CRS, and paste the following in the target-CRS:

+proj=tmerc +lat_0=0 +lon_0=6 +x_0=2500000 +y_0=0 +k=1.000000 +ellps=bessel +units=m +nadgrids=D:\path\to\your\BETA2007.gsb +wktext

-
Andre, thanks for your reply. In a future project I have to transform 300 tiff from UTM to Gauss-Kruger. Today I only have Gauss-Kruger tiffs to test it. I tried 'gdalwarp -s_srs "+proj=tmerc +lat_0=0 +lon_0=6 +k=1 +x_0=2500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs +wktext" -t_srs "+proj=utm +zone=32 +ellps=GRS80 +units=m +no_defs +nadgrids=D:\gis_spielwiese\raster_reproject\BETA2007.gsb +wktext" D:\gis_spielwiese\raster_reproject\4611.tif D:\gis_spielwiese\raster_reproject\4611utm_test7.tif' but there is a shift of 130 m. So I suppose gdalwarp dont make a datum transformation. –  Jens Nov 2 '12 at 16:41
Thats another reason: you have to add +towgs84=0,0,0,0,0,0,0 to the utm string. And its better to write the +nadgrids in the DHDN string. With standard EPSG codes you get an offset of about 2 meters. –  AndreJ Nov 3 '12 at 10:39
With the new parameter it's working fine now. Thanks a lot Andre. –  Jens Nov 7 '12 at 15:17