0

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")

1 Answer 1

4

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.