KipCrossing / geotiff

A noGDAL tool for reading and writing geotiff files
GNU Lesser General Public License v2.1
213 stars 23 forks source link

Issue with transforming EPSG:3035 coords to WGS84 coords with method get_wgs_84_coords() #52

Open jsaladich opened 1 year ago

jsaladich commented 1 year ago

Hi! I have been tracking your amazing library, which seems pretty cool. Yet, I have some problems with the Corine Land Cover geotiff (link to download) As they say, the EPSG is 3035, my final goal is to get some coords in WGS84 (EPSG:4326). First issue. If I open the dataset like this:

corine = GeoTiff('/directory_to_tif/U2018_CLC2018_V2020_20u1.tif', band=0, as_crs=None)

I get an error (pyproj error, asking for a CRS) when trying to pull coords, e.g corine.get_coords(500, 500)

Second issue, if I open manually referencing the EPSG like this

corine = GeoTiff('/directory_to_tif/U2018_CLC2018_V2020_20u1.tif', band=0, as_crs=3035)

It seems to understand everything, (from 3035 to 4326), yet when I pull coords (e.g. for regridding purposes), I get kind of a wrong transformation (see image) image

Latitude in Norway shouldn't be 59º but something like 70º approx. and longitude values are also kind of shifted (like 2-3º), so if I try to reproject to another WGS84 grid you can see both shifts: image

I have tried to use get_coords() insted of get_wgs84_coords() and transform the results using a pyproj transformer, but the error kind of persist... Could you validate it please?