Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
FObermaier opened this issue Jan 21, 2020 · 3 comments · Fixed by #29
Closed

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

FObermaier opened this issue Jan 21, 2020 · 3 comments · Fixed by #29
Assignees
Labels
bug-gdal A bug in GDAL wont-fix/wont-do This will not be worked on

Comments

@FObermaier
Copy link

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.

@FObermaier FObermaier added the bug Something isn't working label Jan 21, 2020
@MaxRev-Dev
Copy link
Owner

Yes, It's an already known issue (#2) . It comes from a swig generated bindings.

All I can do for now - is ignore the redundant files in compile section in project configuration file.

@MaxRev-Dev
Copy link
Owner

It seems like OSGeo.OGR.SpatialReference is used by another type - CoordinateTransformation.
That's another thing that comes from swig interface. Removing this type can lead to consequences we don't intend.

@bjornharrtell Any thoughts on this?

Screenshots (Usages of type)

image

@bjornharrtell
Copy link
Contributor

@MaxRev-Dev no deep thoughts other than to leave it as is. Lots of black magic involved in the swig stuff. Perhaps a FAQ entry to explain to avoid the OGR one.

@MaxRev-Dev MaxRev-Dev added bug-gdal A bug in GDAL wont-fix/wont-do This will not be worked on and removed bug Something isn't working labels Aug 6, 2020
MaxRev-Dev added a commit that referenced this issue Dec 12, 2020
* Release v3.2.0.100
Closes #18, closes #23, closes #11 

* updated links and build instructions

* geos was cached. rebuilt windows packages

* tests configuration update

* updated test targets
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-gdal A bug in GDAL wont-fix/wont-do This will not be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants