MaxRev-Dev / gdal.netcore

GDAL 3.x C#/F# bindings for .NET apps
MIT License
161 stars 36 forks source link

Cannot find grib2_subcenter.csv after upgrade to 3.6.1 #91

Closed sokolik745 closed 1 year ago

sokolik745 commented 1 year ago

I am migrating our backend app to .NET 7 and I updated MaxRev.Gdal.Core and MaxRev.Gdal.LinuxRuntime.Minimal packages to the newest version 3.6.1.100. After this upgrade I am getting this error on jammy linux distribution: System.ApplicationException: Cannot find grib2_subcenter.csv at OSGeo.GDAL.Gdal.Open (MaxRev.Gdal.Core, Version=3.6.1.100, Culture=neutral, PublicKeyToken=null)

I listed the files and folders in the pod and I can't find any data files where could be the grib2_subcenter.csv file located according to this. I cant find any path runtimes/linux-x64/native/ either which is defined here.

The code is just trying to open this file raster.zip. I am not sure why this is happening because this file is not grib file.

It is working fine when it runs on Windows.

MaxRev-Dev commented 1 year ago

It seems like a part of your code is using the GRIB driver, which requires the GDAL_DATA folder (or GRIB_RESOURCE_DIR) to be present. This was broken only in our latest version, 3.6.1, according to the changelog.

By default, this package only provides a PROJ database (grid shifts). Nothing from the GDAL_DATA folder was packaged before. I can introduce a patch soon to include grids and other data files in the Core package.

As a temporary workaround, you can download the gdal/data folder and set the environment variable (GDAL_DATA) to match this folder.

sokolik745 commented 1 year ago

Thank you for your quick reply I appreciate it. It would be great to have an updated package but we will try the workaround in the meanwhile.

sokolik745 commented 1 year ago

It seems that the proposed workaround is not working. I copied the gdal data and set the environment variable as you can see here: image image It is still not working. Am I missing something?

MaxRev-Dev commented 1 year ago

Yes. You did not set the environment variable correctly to point to that folder. echo $GDAL_DATA

sokolik745 commented 1 year ago

Sorry, my mistake. Wrong screenshot. The environment variable is set to this: image

MaxRev-Dev commented 1 year ago

You can also try to set it as a config option with Gdal.SetConfigOption("GDAL_DATA", path)

sokolik745 commented 1 year ago

Unfortunately I am not able to get it work either. Maybe we will just wait for the new version of package. Or do you have any other suggestions? Thanks!

MaxRev-Dev commented 1 year ago

Here you go: gdal-grib-repro.zip

  1. Without a defined GDAL_DATA path
  2. And after setting a config option image
sokolik745 commented 1 year ago

Nice it works. Our problem was in pipelines and your solution is working. Thank you!