I want to reproject a raster image that is given as a geoTiff file into another coordinate system. The map is in WGS84-Pseudo-Mercator.
But when I run the following code I only get a white image as my output raster. How can I fix this?
import rioxarray
rds = rioxarray.open_rasterio("path_to_raster.tif")
crs = "EPSG:4978" # this depends on the exact projection you want to use
projected = rds.rio.reproject(crs)
projected.rio.to_raster("path_to_enu_raster.tif")
Well I found a solution by trial and error. This code works for germany:
from osgeo import gdal
filename = "berlin.tif"
input_raster = gdal.Open(filename)
for epsg in ["EPSG:4839", "EPSG:3068", "EPSG:25833"]:
gdal.Warp('output_raster' + epsg + '.tif', input_raster, dstSRS=epsg)