Skip to content

feat(c/sedona-gdal): add crate with dynamically loaded GDAL bindings#681

Open
Kontinuation wants to merge 4 commits intoapache:mainfrom
Kontinuation:feat/sedona-gdal-ffi
Open

feat(c/sedona-gdal): add crate with dynamically loaded GDAL bindings#681
Kontinuation wants to merge 4 commits intoapache:mainfrom
Kontinuation:feat/sedona-gdal-ffi

Conversation

@Kontinuation
Copy link
Member

Summary

  • Add the sedona-gdal crate providing runtime-loaded GDAL FFI bindings via libloading, following the same pattern as sedona-proj.
  • Contains the SedonaGdalApi function-pointer struct, dynamic symbol loading (dyn_load), the GdalApi handle with call_gdal_api! macro, error types, and global API registration.
  • Integrates into the workspace (Cargo.toml, rust/sedona/Cargo.toml) and CI (.github/workflows/rust.yml adds libgdal-dev).

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.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-gdal crate with FFI bindings for 69 GDAL symbols, version checking, and a global API registration pattern
  • Workspace integration in Cargo.toml and rust/sedona/Cargo.toml following the same approach as sedona-proj
  • CI update to install libgdal-dev alongside libgeos-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.

@Kontinuation Kontinuation force-pushed the feat/sedona-gdal-ffi branch from e7f3874 to d257371 Compare March 4, 2026 05:44
- 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.
@Kontinuation Kontinuation changed the title feat(sedona-gdal): add crate with dynamically loaded GDAL bindings feat(c/sedona-gdal): add crate with dynamically loaded GDAL bindings Mar 4, 2026
@Kontinuation Kontinuation marked this pull request as ready for review March 4, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants