bertt / GdalOnNet8Sample

MIT License
19 stars 4 forks source link

Correct GDAL C# bindings usage #6

Closed MaxRev-Dev closed 2 years ago

MaxRev-Dev commented 2 years ago

Hi, I'm a maintainer of bindings library your project depends on. Looking through github repos usages for a better understanding how it used by developers. Glad to see that the library is widely used, as your sample project is stared by 10+ devs, and a the usage is higher, of course.

Please, update usages of bindings according to the documentation. PROJ_PATH and other environmental variables should be set using a static method Maxrev.Gdal.Core.GdalBase.ConfigureAll(). This removes several bugs on configuring your app in different environments. You can see the sources and documentation for details.

bertt commented 2 years ago

Hi, ah good to know, I've made a change, it's good like this? https://github.com/bertt/GdalOnNet6Sample/commit/511f26a64df1d5fb40668f9e2b68261860b57e12

Maybe the methods Gdal.AllRegister() and Ogr.RegisterAll() could be removed/ marked obsolete?

Backstory: I've used other packages before changing to your packages (Gdal.Core/2.3.0-beta-023), everything seemed to be working quickly (so I didn't check any further). Blog see https://bertt.wordpress.com/2022/02/25/using-gdal-in-net-6/

MaxRev-Dev commented 2 years ago

Yes, changes in https://github.com/bertt/GdalOnNet6Sample/commit/511f26a64df1d5fb40668f9e2b68261860b57e12 are the way to go, and the docs could be updated accordingly. I can't change native GDAL methods without advanced scripting. Gdal.AllRegister() and Ogr.RegisterAll() are not located in partial classes, it will be complicated to apply that changes, because every time when compiling new GDAL version - bindings sources are generated from scratch. I mentioned about those problems in the repository in readme and already fixed all critical issues related to those cases. Just hoping, people will go to repository and look in readme before the usage🤷‍♂️.