georust / gdal

Rust bindings for GDAL
https://crates.io/crates/gdal
MIT License
369 stars 94 forks source link

Can add wrapper for GDALAutoCreateWarpedVRT? #549

Open z954134 opened 3 months ago

z954134 commented 3 months ago

i use this to change gdal2tiles from python to rust,found no GDALAutoCreateWarpedVRT. pub fn GDALAutoCreateWarpedVRT(src: &Dataset, wkt1:&str, wkt2: &str) -> GDALDatasetH { let c_str_1 = CString::new(wkt1).unwrap(); let c_ptr_1: const c_char = c_str_1.as_ptr(); let c_str_2 = CString::new(wkt2).unwrap(); let c_ptr_2: const c_char = c_str_2.as_ptr(); let rv = unsafe { gdal_sys::GDALAutoCreateWarpedVRT( src.c_dataset(), c_ptr_1, c_ptr_2, GDALResampleAlg::GRA_Bilinear, 0.0, null_mut(), ) }; rv } but this is unsafe,can add this wrapper?

ChristianBeilschmidt commented 3 weeks ago

Usually, it is okay to add missing functions to the library. Most of them have to wrap unsafe code because of C-pointers.