Closed LGinC closed 1 month ago
@LGinC CentOS 7 is not supported anymore. Consider moving to another distro or use docker. Read this doc section.
OK, I install gdal from source code, and how to configure to make MaxRev.Gdal.Core find gdal library
$gdalinfo --version
GDAL 3.9.3, released 2024/10/07 (debug build)
@LGinC This requires advanced manual setup.
GdalBase.EnableRuntimeValidation = false;
. Before calling GdalBase.ConfigureAll();
<GdalFolder>\bin\gdal\csharp
. Link them (add a reference) in your csproj
project file to each gdal_csharp.dll, gdalconst_csharp.dll, ogr_csharp.dll and osr_csharp.dll
. This will work only for one runtime. Use conditional mapping if you need Linux runtime.The step 2 requires GDAL to be compiled with bindings enabled, otherwise works only via CLI.
So I wouldn't recommend this. The bindings are being compiled during the GDAL build and this generates corresponding C# interface. Binaries are placed in the same directory, so the startup knows what to utilize. You need either to use CLI tools or dockerized .NET app with GDAL packages.
@MaxRev-Dev thx I found it change proj.db search directory and it work
if(OperatingSystem.IsLinux())
{
GdalBase.EnableRuntimeValidation = false;
GdalBase.ConfigureGdalDrivers();
Proj.Configure("/usr/local/share/proj/");
}
else
GdalBase.ConfigureAll();
it work fine in windows, and I just run
dotnet build -c Release
and copy release folder to linux serverEnvironment information: