Closed pdxrlj closed 1 year ago
Can you give me some examples? I tried to use BuildVrt in the "example" folder but it didn't work. I want to achieve the following effect:
fn warped_vrt(&self, sp_ref: &SpatialRef) -> Result<Dataset, Box
let mut str_opts = CslStringList::new();
str_opts.set_name_value("INIT_DEST", "NO_DATA")?;
str_opts.set_name_value("NUM_THREADS", "1")?;
let mut options = unsafe { GDALCreateWarpOptions() };
unsafe { (*options).dfWarpMemoryLimit = 2048. * 1024. * 1024. };
unsafe {
(*options).papszWarpOptions = str_opts.as_ptr();
}
let vrt: GDALDatasetH = unsafe {
GDALAutoCreateWarpedVRT(
self.ds.c_dataset(),
src_wkt.as_ptr(),
target_wkt.as_ptr(),
GDALResampleAlg::GRA_NearestNeighbour,
0. as c_double,
options,
)
};
if vrt.is_null() {
return Err(String::from("could not create WarpedVRT").into());
}
let gdal_dataset = unsafe { GDALDataset::from_c_dataset(vrt) };
Ok(Dataset { ds: gdal_dataset })
}
Originally posted by @tbonfort in https://github.com/airbusgeo/godal/issues/108#issuecomment-1500060086