Struct shapefile::writer::ShapeWriter [−][src]
struct that handles the writing of the .shp and (optionally) the .idx
The recommended way to create a ShapeWriter by using ShapeWriter::from_path
Important
As this writer does not write the .dbf, it does not write what is considered a complete (thus valid) shapefile.
Implementations
impl<T: Write + Seek> ShapeWriter<T>
[src]
impl<T: Write + Seek> ShapeWriter<T>
[src]pub fn new(shp_dest: T) -> Self
[src]
Creates a writer that can be used to write a new shapefile.
The dest
argument is only for the .shp
pub fn with_shx(shp_dest: T, shx_dest: T) -> Self
[src]
pub fn write_shape<S: EsriShape>(&mut self, shape: &S) -> Result<(), Error>
[src]
Write the shape to the file
Examples
use shapefile::Point; let mut writer = shapefile::ShapeWriter::from_path("points.shp")?; writer.write_shape(&Point::new(0.0, 0.0))?; writer.write_shape(&Point::new(1.0, 0.0))?; writer.write_shape(&Point::new(2.0, 0.0))?;
pub fn write_shapes<'a, S: EsriShape + 'a, C: IntoIterator<Item = &'a S>>(
self,
container: C
) -> Result<(), Error>
[src]
self,
container: C
) -> Result<(), Error>
Writes a collection of shapes to the file
Examples
use shapefile::Point; let mut writer = shapefile::ShapeWriter::from_path("points.shp")?; let points = vec![Point::new(0.0, 0.0), Point::new(1.0, 0.0), Point::new(2.0, 0.0)]; writer.write_shapes(&points)?;
use shapefile::{Point, Polyline}; let mut writer = shapefile::ShapeWriter::from_path("polylines.shp")?; let points = vec![Point::new(0.0, 0.0), Point::new(1.0, 0.0), Point::new(2.0, 0.0)]; let polyline = Polyline::new(points); writer.write_shapes(&vec![polyline])?;
impl ShapeWriter<BufWriter<File>>
[src]
impl ShapeWriter<BufWriter<File>>
[src]Trait Implementations
Auto Trait Implementations
impl<T> RefUnwindSafe for ShapeWriter<T> where
T: RefUnwindSafe,
impl<T> RefUnwindSafe for ShapeWriter<T> where
T: RefUnwindSafe,
impl<T> Send for ShapeWriter<T> where
T: Send,
impl<T> Send for ShapeWriter<T> where
T: Send,
impl<T> Sync for ShapeWriter<T> where
T: Sync,
impl<T> Sync for ShapeWriter<T> where
T: Sync,
impl<T> Unpin for ShapeWriter<T> where
T: Unpin,
impl<T> Unpin for ShapeWriter<T> where
T: Unpin,
impl<T> UnwindSafe for ShapeWriter<T> where
T: UnwindSafe,
impl<T> UnwindSafe for ShapeWriter<T> where
T: UnwindSafe,