I have an image in tif-format of size 18346x10218 in coordinate system EPSG:4326 that I want to convert to a new coordinate system, which I do with the following method with rioxarray in Python.
import rioxarray
rast_path = "old_projection.tif"
rds = rioxarray.open_rasterio(rast_path)
rds_3996 = rds.rio.reproject("EPSG:3996")
rds_3996.rio.to_raster("new_projection.tif")
This saves the tif file in the new projection, but I noticed that it increases the image size to 20198x20198. When I open the file, the new pixels are not visible, so I assume they do not contain any data, but the size of the file has more than doubled. Is there a way to re-project data in this manner without saving the empty pixels? Thanks for any help!
Try like this: