pub fn gdal_resource_from_df<P: AsRef<Path>>(
    df: &DataFrame,
    driver: &Driver,
    path: P,
    params: Option<WriteParams<'_>>
) -> Result<Dataset, Error>
Expand description

Given a dataframe, write to a GDAL resource path and return the dataset.

If given a path to local disk, the file will be written to local disk. If given a URI for a GDAL supported remote resource, the dataframe will be written to that resource in the specified geospatial format.

Currently, only vector drivers are supported. For raster support, use gdal_layer_from_df.

Example

use polars_gdal::{gdal, gdal_resource_from_df};

let df: DataFrame = ...;
let shapefule_driver = gdal::DriverManager::get_driver_by_name("ESRI Shapefile")?;
let dataset = gdal_resource_from_df(&df, &shapefule_driver, "/some/path/my_shapefile.shp", None)?;
println!("{}", String::from_utf8(geojson_bytes)?);