feat(c/sedona-gdal): add crate with dynamically loaded GDAL bindings#681
Open
Kontinuation wants to merge 4 commits intoapache:mainfrom
Open
feat(c/sedona-gdal): add crate with dynamically loaded GDAL bindings#681Kontinuation wants to merge 4 commits intoapache:mainfrom
Kontinuation wants to merge 4 commits intoapache:mainfrom
Conversation
Add the sedona-gdal crate providing runtime-loaded GDAL FFI bindings via libloading. This includes the SedonaGdalApi function-pointer struct, dynamic symbol loading, the GdalApi handle with call_gdal_api! macro, error types, and global API registration.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds the sedona-gdal crate, a dynamically loaded GDAL FFI binding layer following the pattern established by sedona-proj. The crate provides runtime symbol resolution via libloading, a global GdalApi handle, error types, and a call_gdal_api! macro. It integrates into the workspace build and adds libgdal-dev to CI.
Changes:
- New
c/sedona-gdalcrate with FFI bindings for 69 GDAL symbols, version checking, and a global API registration pattern - Workspace integration in
Cargo.tomlandrust/sedona/Cargo.tomlfollowing the same approach assedona-proj - CI update to install
libgdal-devalongsidelibgeos-dev
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
c/sedona-gdal/Cargo.toml |
New crate manifest with optional gdal-sys, libloading, and thiserror dependencies; incorrectly declares staticlib+cdylib+lib crate types |
c/sedona-gdal/src/lib.rs |
Crate root re-exporting public API; gdal_dyn_bindgen is public contrary to sedona-proj convention |
c/sedona-gdal/src/gdal_dyn_bindgen.rs |
FFI type definitions, enums, and the SedonaGdalApi function-pointer struct |
c/sedona-gdal/src/dyn_load.rs |
Symbol loading macros and load_all_symbols; field count in docstring is inaccurate; no platform fallback |
c/sedona-gdal/src/gdal_api.rs |
GdalApi wrapper, call_gdal_api! macro; last_cpl_err always returns an error; stale docstring |
c/sedona-gdal/src/errors.rs |
GdalError and GdalInitLibraryError types (ported from georust/gdal) |
c/sedona-gdal/src/register.rs |
Global OnceLock<GdalApi> initialization; configure_global_gdal_api silently no-ops on repeat calls |
Cargo.toml |
Workspace registration of sedona-gdal with default-features = false |
rust/sedona/Cargo.toml |
Adds sedona-gdal as an unconditional dependency and gdal feature flag |
.github/workflows/rust.yml |
Adds libgdal-dev to the dependency installation step |
Cargo.lock |
Adds gdal-sys 0.12.0 and sedona-gdal 0.3.0 entries |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
e7f3874 to
d257371
Compare
- Introduce GdalApiBuilder with lazy initialization pattern (similar to sedona-proj's ProjCrsEngineBuilder): configure_global_gdal_api now stores a builder in a Mutex, and get_global_gdal_api builds the API on first access. This allows callers to override configuration before the first GDAL operation. - Add compile_error! for unsupported platforms (non-unix, non-windows) in current_process_library. - Add 9 unit tests covering loading errors, symbol loading, builder configuration, and global API access.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sedona-gdalcrate providing runtime-loaded GDAL FFI bindings vialibloading, following the same pattern assedona-proj.SedonaGdalApifunction-pointer struct, dynamic symbol loading (dyn_load), theGdalApihandle withcall_gdal_api!macro, error types, and global API registration.Cargo.toml,rust/sedona/Cargo.toml) and CI (.github/workflows/rust.ymladdslibgdal-dev).