0

I have a tif file with the projection USER: 100032. And I want to reproject it to EPSG: 4326. I have previously done it in a similar way for a similar projection and used gdal.Warp(). The physical place is the same in the world (Alaska), but now it seems to change both the extent and most importantly the pixel size.

I have tried this solution, but it did not seem to work.

How can I make sure, I save the resolution, extent and the pixel size?

Here is the information:

Previously projected 100032 to 4326

CRS EPSG:4326 - WGS 84 - Geographic Extent -179.7565878540000028,41.0971949020000054 : 179.9819728149999207,73.2747258849999952 Unit degrees Width 596 Height 130

Dimensions X: 596 Y: 130 Bands: 1 Origin -179.757,73.2747 Pixel Size 0.6035881890419462215,-0.2475194690999999447

New GeoTIF projected 100032 to 4326

CRS EPSG:4326 - WGS 84 - Geographic Extent -179.9999232519033967,0.5107936126474186 : 179.6827057096168119,85.4634587402992878 Unit degrees Width 725 Height 171

Dimensions X: 725 Y: 171 Bands: 1 Origin -180,85.4635 Pixel Size 0.496113970981407193,-0.4967992112728179532

This is the gdal.Warp process that happens

gdalwarp -s_srs "+proj=lcc +lat_1=50.00000381469727 +lat_0=50.00000381469727 +lon_0=-107.0000076293945 +k_0=1 +x_0=0 +y_0=0 +a=6367470 +b=6367470 +units=km +no_defs" -t_srs EPSG:4326 -r near -of GTiff

I eventually need to turn these into nc files so I can calculate some things, but the latitude and longitude are for now completely off, so it will not work. I will only get 0's as the spatial resolutions are not equal.

How can I make sure the Extent and Pixel size are similar in the new projection as they were in the old projection?

Thomas
  • 905
  • 4
  • 21

2 Answers2

1

I don't know how you can do this on command line gdal, but if you use gdalwarp wrapped on QGIS (3.16, 3.18) GUI "Warp (reproject)" on Processing Toolbox, it gives you the option to select the previously projected raster extents as parameters for your new projected one. This way, the pixel size can also be controlled.

Another approach would be to reproject and then resample the projected raster to match the extents of your other raster.

What I think could be the cause of this difference is the path the transformations are taking, some transformations between CRS are more direct but some need a series of in-between transformations and can be done by different sequences. Since your coordinate system appears to be custom ("USER: ...") you can try to check what is the transformation that is being performed between your user defined CRS and EPSG 4326.

L. Lucchese
  • 178
  • 1
  • 4
1

Partly consulting L. Lucchese's answer I managed to resolve the problem.

  1. I reprojected the USER:100032 to EPSG:102002 by simply saving it and change the CRS myself.
  2. Then I did not use gdal.Warp but again simply exported and saved the .tif file separately.
  3. Here, I set the CRS to EPSG:4326, the extent was set to -179.7565878540000028, 41.0971949020000054 : 179.9819728149999207,73.2747258849999952 as in the first file in the question.
  4. The tricker was setting the resolution to the given pixel size Pixel Size 0.6035881890419462215, 0.2475194690999999447 from file one.
  5. Then saved and exported, and it hereby worked.
Thomas
  • 905
  • 4
  • 21