I'm trying to crop a larger GeoTIFF file to a smaller extent.
The darker GeoTIFF file in the middle has the extent I want to reproject to. I've used the following command to do the translation:
gdal_translate -projwin 15.77934913 45.9207350629 16.24003059 45.712685371 large.tif large_translated.tif
However, after applying this I'm left with the following:
The green border is the reprojected GeoTIFF. As you can see it doesn't align with the smaller GeoTIFF and the resulting extent confirms that.
My target extent was:
15.7793491382775120,45.7126853719947803 : 16.2400305969196452,45.9207350629944528
The resulting extent is:
15.6999931171728377,45.7999983767051972 : 16.1999931826612027,45.9999983657800513
What am I doing wrong and how can I achieve the wanted behaviour through gdal?
GDAL 3.7.0, released 2023/05/02
. I've resorted to usinggdalwarp
instead ofgdal_translate
as it seems to work as expected. Version in QGIS isGDAL 3.7.2, released 2023/09/05
which exhibits the same behaviour.-outsize
or target resolution-tr
is defined.