Skip to main content

write_vector

Function write_vector 

Source
pub fn write_vector(
    layers: &[Layer],
    path: &str,
    options: &VectorWriteOptions,
) -> Result<()>
Expand description

Writes vector layers. GeoPackage, GPX, KML, KMZ and TopoJSON hold several layers in one file; for the other formats, write one layer at a time.

With the gdal feature, an extension terrio has no driver for is written by the GDAL driver that claims it (.dxf, .gdb; see gdal_backend::write_vector).

let ds = terrio::open_vector("countries.shp", &Default::default())?;
terrio::write_vector(&ds.layers, "countries.gpkg", &Default::default())?;
let mut options = terrio::VectorWriteOptions::default();
options.geojson.set("RFC7946", "YES")?;
terrio::write_vector(&ds.layers, "countries.geojson", &options)?;