Skip to content

[BUG] Namespace OSGeo.OGR contains non-functional SpatialReference class #11

@FObermaier

Description

@FObermaier

Describe the bug
The namespace OSGeo.OGR contains non-functional SpatialReference class. I think it is not to be there at all. Attempts to use it by calling constructor new OSGeo.OGR.SpatialReference([null|string.Empty|valid wkt]) lead to

System.EntryPointNotFoundException: 'Unable to find an entry point named 'CSharp_OSGeofOGR_new_SpatialReference___' in DLL 'osr_wrap'.'

To Reproduce
Gdal3CoreApp.csproj:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>netcoreapp2.2</TargetFramework>
    <PlatformTarget>x64</PlatformTarget>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="MaxRev.Gdal.Core" Version="3.0.1.25" />
    <PackageReference Include="MaxRev.Gdal.WindowsRuntime.Minimal" Version="3.0.1.35" />
  </ItemGroup>

</Project>

Program.cs:

namespace Gdal3CoreApp
{
    class Program
    {
        static void Main(string[] args)
        {
            MaxRev.Gdal.Core.GdalBase.ConfigureAll();
            System.Console.WriteLine($"IsConfigured = {MaxRev.Gdal.Core.GdalBase.IsConfigured}");

            string wkt = null;
            using (var sr = new OSGeo.OGR.SpatialReference(wkt))
            {
                if (sr.ImportFromEPSG(4326) == 0)
                {
                    if (sr.ExportToWkt(out wkt, null) == 0)
                        System.Console.WriteLine(wkt);
                }
                else
                {
                    System.Console.WriteLine("Could not identify EPSG:4326");
                }
            }
        }
    }
}

Expected behavior
The OSGeo.OGR.SpatialReference class should not be present at all.
Using OSGeo.OSR.SpatialReference works fine.

Environment information:

  • OS (version): Windows 10 (1909)
  • Package version (core): 3.0.1.25
  • Package version (runtime): 3.0.1.35

Additional context
I have not tested the linux runtime.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions