Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
- name: Install dependencies
shell: bash
run: |
sudo apt-get update && sudo apt-get install -y libgeos-dev
sudo apt-get update && sudo apt-get install -y libgeos-dev libgdal-dev

- name: Check
if: matrix.name == 'check'
Expand Down
21 changes: 21 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ members = [
"c/sedona-geoarrow-c",
"c/sedona-geos",
"c/sedona-libgpuspatial",
"c/sedona-gdal",
"c/sedona-proj",
"c/sedona-s2geography",
"c/sedona-tg",
Expand Down Expand Up @@ -149,6 +150,7 @@ sedona-testing = { version = "0.3.0", path = "rust/sedona-testing" }
# C wrapper crates
sedona-geoarrow-c = { version = "0.3.0", path = "c/sedona-geoarrow-c" }
sedona-geos = { version = "0.3.0", path = "c/sedona-geos" }
sedona-gdal = { version = "0.3.0", path = "c/sedona-gdal", default-features = false }
sedona-proj = { version = "0.3.0", path = "c/sedona-proj", default-features = false }
sedona-s2geography = { version = "0.3.0", path = "c/sedona-s2geography" }
sedona-tg = { version = "0.3.0", path = "c/sedona-tg" }
45 changes: 45 additions & 0 deletions c/sedona-gdal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

[package]
name = "sedona-gdal"
version.workspace = true
license.workspace = true
keywords.workspace = true
categories.workspace = true
authors.workspace = true
homepage.workspace = true
repository.workspace = true
description.workspace = true
readme.workspace = true
edition.workspace = true
rust-version.workspace = true

[lib]
crate-type = ["staticlib", "cdylib", "lib"]

[dependencies]
gdal-sys = { version = "0.12.0", optional = true }
libloading = { workspace = true }
thiserror = { workspace = true }

[features]
default = ["gdal-sys"]
gdal-sys = ["dep:gdal-sys"]

[dev-dependencies]
sedona-testing = { workspace = true }
42 changes: 42 additions & 0 deletions c/sedona-gdal/src/config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

//! Ported (and contains copied code) from georust/gdal:
//! <https://github.com/georust/gdal/blob/v0.19.0/src/config.rs>.
//! Original code is licensed under MIT.
//!
//! GDAL configuration option wrappers.

use std::ffi::CString;

use crate::errors::Result;
use crate::gdal_api::{call_gdal_api, GdalApi};

/// Set a GDAL library configuration option with **thread-local** scope.
pub fn set_thread_local_config_option(api: &'static GdalApi, key: &str, value: &str) -> Result<()> {
let c_key = CString::new(key)?;
let c_val = CString::new(value)?;
unsafe {
call_gdal_api!(
api,
CPLSetThreadLocalConfigOption,
c_key.as_ptr(),
c_val.as_ptr()
);
}
Ok(())
}
Loading