1

I've got a TIFF in projection (proj4: +proj=stere +lat_0=90 +lat_ts=60 +lon_0=-80 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs). Would like to convert it to EPSG:3857. ArcMap does it correctly, but GDAL does not. I tried gdalwarp:

gdalwarp -s_srs "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=-80 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs" -t_srs EPSG:3857 -co "COMPRESS=LZW"

Gdalwarp generates more or less empty output.

So I tried gdal_translate:

gdal_translate -projwin_srs "+proj=stere +lat_0=90 +lat_ts=60 +lon_0=-80 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs" -a_srs EPSG:3857 -co "COMPRESS=LZW"

It gives some result, but it's wrong. Both results are the same when doing them in Python.

ArcMap doesn't have a problem with that. Any ideas how to make it automatically with Python (not using ArcPy!)?

The results and input raster are here (around 1-3MB each): https://drive.google.com/drive/folders/1NyXjYqSJI8KUSgA4AwTQbfLHCQhxILPG?usp=sharing

2
  • Seems that the problem appears only on Windows. Dec 23, 2023 at 12:40
  • 2
    EPSG:3857 is not valid near the poles. The transformation works if you exclude the invalid area by setting the target extent parameter manually gdalwarp -t_srs EPSG:3857 -r near -of GTiff input.tif out.tif -te -180 -30 180 85 -te_srs epsg:4326. After the GDAL improvement that is already done due to the ticket that you created the clipping is done automatically, but user must still be aware that the polar area gets lost in the transformation.
    – user30184
    Dec 23, 2023 at 18:54

1 Answer 1

1

Seems to work fine for me with a simple:

gdalwarp -t_srs EPSG:3857 -r average -of GTiff input.tif out.tif

Your file already has a CRS set so no need to override it.

enter image description here

GDAL 3.8.1, released 2023/11/28

6
  • GDAL 3.8.2, released 2023/16/12 (freshly installed on fresh Windows) - got the same result as I attached in google drive. Just a black stripe. Same on GDAL 3.0.2. Are You doing it on Windows or Linux? Dec 23, 2023 at 11:10
  • Weird! I am on Linux. Maybe there is a bad CRS in an auxiliary file overriding the one in the file? Can you try in a new directory with only the one single input file in it? Dec 23, 2023 at 11:19
  • I did, on totally fresh OSGeo4W installation on fresh Windows 11. Still the same. Dec 23, 2023 at 11:24
  • 1
    I guess it's a GDAL bug, but if You have any ideas on how to fix it, would be great. I've reported that issue on OSGeo github. Dec 23, 2023 at 11:35
  • 1
    Here's the issue: github.com/OSGeo/gdal/issues/8996 . Thank You for trying to help anyway. Dec 23, 2023 at 12:35

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.