Struct shapefile::writer::Writer [−][src]
The Writer writes a complete shapefile that is, it writes the 3 mandatory files (.shp, .shx, .dbf)
The recommended way to create a new shapefile is via the Writer::from_path or Writer::from_path_with_info associated functions.
Examples
To create a Writer that writes a .dbf file that has the same structure as .dbf read earlier you will have to do:
let mut reader = shapefile::Reader::from_path("tests/data/multipatch.shp")?; let shape_records = reader.read()?; let table_info = reader.into_table_info(); let writer = shapefile::Writer::from_path_with_info("new_multipatch.shp", table_info);
Implementations
impl<T: Write + Seek> Writer<T>
[src]
impl<T: Write + Seek> Writer<T>
[src]pub fn new(shape_writer: ShapeWriter<T>, dbase_writer: TableWriter<T>) -> Self
[src]
Creates a new writer using the provided ShapeWriter and TableWriter
Example
Creating a Writer that writes to in memory buffers.
use std::convert::TryInto; let mut shp_dest = std::io::Cursor::new(Vec::<u8>::new()); let mut shx_dest = std::io::Cursor::new(Vec::<u8>::new()); let mut dbf_dest = std::io::Cursor::new(Vec::<u8>::new()); let shape_writer = shapefile::ShapeWriter::with_shx(&mut shp_dest, &mut shx_dest); let dbase_writer = dbase::TableWriterBuilder::new() .add_character_field("Name".try_into().unwrap(), 50) .build_with_dest(&mut dbf_dest); let shape_writer = shapefile::Writer::new(shape_writer, dbase_writer);
pub fn write_shape_and_record<S: EsriShape, R: WritableRecord>(
&mut self,
shape: &S,
record: &R
) -> Result<(), Error>
[src]
&mut self,
shape: &S,
record: &R
) -> Result<(), Error>
pub fn write_shapes_and_records<'a, S: EsriShape + 'a, R: WritableRecord + 'a, C: IntoIterator<Item = (&'a S, &'a R)>>(
self,
container: C
) -> Result<(), Error>
[src]
self,
container: C
) -> Result<(), Error>
impl Writer<BufWriter<File>>
[src]
impl Writer<BufWriter<File>>
[src]pub fn from_path<P: AsRef<Path>>(
path: P,
table_builder: TableWriterBuilder
) -> Result<Self, Error>
[src]
path: P,
table_builder: TableWriterBuilder
) -> Result<Self, Error>
Creates all the files needed for the shapefile to be complete (.shp, .shx, .dbf)
use std::convert::TryInto; let table_builder = dbase::TableWriterBuilder::new() .add_character_field("name".try_into().unwrap(), 50); let writer = shapefile::Writer::from_path("new_cities.shp", table_builder)?;
pub fn from_path_with_info<P: AsRef<Path>>(
path: P,
table_info: TableInfo
) -> Result<Self, Error>
[src]
path: P,
table_info: TableInfo
) -> Result<Self, Error>
Auto Trait Implementations
impl<T> RefUnwindSafe for Writer<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for Writer<T> where
T: RefUnwindSafe,
impl<T> UnwindSafe for Writer<T> where
T: UnwindSafe,
impl<T> UnwindSafe for Writer<T> where
T: UnwindSafe,