1

I have a raster being changed from EPSG:27700 to EPSG:3857 coordinate reference system.

Within the QGIS application, I have found this coordinate transformation to fit the best

enter image description here

I've tried to replicate this coordinate transformation in GDAL and assumed that by declaring -ct "+proj=pipeline +step +inv +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +step +proj=push +v_3 +step +proj=cart +ellps=airy +step +proj=helmert +x=371 +y=-111 +z=434 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84" as per the QGIS window, I'd get the same result. Sadly not. Using GDAL and this -ct my raster is ending up on the coast of Alaska when it should be in the UK.

What am I doing wrong?

This is the GDAL command I was using

gdalwarp -ct "+proj=pipeline +step +inv +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +step +proj=push +v_3 +step +proj=cart +ellps=airy +step +proj=helmert +x=371 +y=-111 +z=434 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84" C:/new/DensA_20210506.tif C:/new/DensA_20210506_gdal.tif
6
  • Maybe you are changing the geotransformation but not the reference system. What happens if you include the -t_srs EPSG:3857 parameter within the same gdalwarp command? Aug 18, 2022 at 2:49
  • @GabrielDeLuca adding -t_srs EPSG: 3857 does the default geotransformation then, which isnt what I want as it is off by over 2m. Aug 18, 2022 at 9:18
  • Did you try? Because i think you are overriding the default transformation with the -ct pipeline. Or open the raster layer in QGIS and just set EPSG:3857 as its CRS. Aug 18, 2022 at 11:43
  • @GabrielDeLuca yes I tried gdalwarp -t_srs EPSG:3857 -ct "+proj=pipeline +step +inv +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +step +proj=push +v_3 +step +proj=cart +ellps=airy +step +proj=helmert +x=371 +y=-111 +z=434 +step +inv +proj=cart +ellps=WGS84 +step +proj=pop +v_3 +step +proj=webmerc +lat_0=0 +lon_0=0 +x_0=0 +y_0=0 +ellps=WGS84" C:/new/DensA_20210506.tif C:/new/DensA_20210506_gdal_try.tif Aug 18, 2022 at 11:44
  • Your -ct pipeline doesn't seem like the one selected in the screenshot. Maybe you are copying the default one so obtaining it. Aug 18, 2022 at 11:59

1 Answer 1

1

When applying a set of transformations and/or conversions through a PROJ pipeline inside the -ct parameter of gdalwarp, the coordinates of the pixels are changed, but not the reference system of those coordinates.

In order for the new coordinates to correspond to the same location on Earth as the previous ones, the target Spatial Reference System must also be modified through the -t_srs parameter.

The source geospatial location was already defined in the source file, through a geotransform matrix or control points, referenced to a source SRS. The set of operations from the source (in the file) to the destination (in the -t_srs parameter) SRS is overwritten with the -ct command, avoiding the search of the default operation within the PROJ database.

Therefore, to custom transform to a new SRS, it is necessary to define both -ct and -t_srs parameters on the gdawarp command line.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.