MaxRev-Dev / gdal.netcore

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

[BUG] Can't find proj.db #71

Closed PhilCliv closed 2 years ago

PhilCliv commented 2 years ago

Using the library locally, everything is fine. (Without calling GdalBase.ConfigureAll()) When deployed on Windows server 2019, I get this error "System.ApplicationException: PROJ: pj_obj_create: Cannot find proj.db"

I then tried to add the line "GdalBase.ConfigureAll();" and I get this error "System.IO.FileNotFoundException: 'Can't find proj.db. Tried to search in" locally.

Any idea how to resolve this problem? Thanks in advance

PhilCliv commented 2 years ago

In local, I can see the location of proj.db in \bin\Debug\netcoreapp3.1\gdal\share\ But I can't see it in the destination folder when I "publish" my project. Is that helping?

PhilCliv commented 2 years ago

I could make it work on the server by copying the content of the local folder "\bin\Debug\netcoreapp3.1\gdal\share\" to the folder on the server "\runtimes\win-x64\native\maxrev.gdal.core.libshared". (I had to create the maxrev.gdal.core.libshared folder). Is there a way to avoid this?

MaxRev-Dev commented 2 years ago

Have you installed MaxRev.Gdal.WindowsRuntime.Minimal package? Msbuild should copy package content automatically on build, because proj database is already included in package definition. How do you publish your app? https://github.com/MaxRev-Dev/gdal.netcore/blob/eaed6417d69c476e441f60768cf56183054ce6fd/gdalcore.windowsruntime.csproj#L37-L44

PhilCliv commented 2 years ago

Perfect! I could it make working with your package MaxRev.Gdal.WindowsRuntime.Minimal. I was using the package MaxRev.Gdal.Core. And I didn't have to call GdalBase.ConfigureAll(); Thanks