I'm writing a QGIS plugin that will reproject a raster.
I have all the pieces and it's writing a new raster with the new projection, but isn't reprojecting the underlying data.
The QGIS documentation says 'CRS to reproject to' but I'm concerned that no reprojection is being done. I'd prefer not to use GDAL, but I'm now at the point where I've exhausted my options in the PyQGIS API, I think...
My code is below:
layer.setCrs(orig_crs)
tr = QgsCoordinateTransform(orig_crs, dest_crs)
file_writer = QgsRasterFileWriter(out_file)
pipe = QgsRasterPipe()
provider = layer.dataProvider()
pipe.set(provider.clone())
result = file_writer.writeRaster(pipe,
provider.xSize(),
provider.ySize(),
tr.transform(provider.extent()),
dest_crs)
Edit: I'm editing now and will add a bounty.
The question really is this: How can you use the built-in QGIS Python API functionality to transform a raster. Answers accepted for QGIS 2.0 or 3.0.