Struct shapefile::writer::ShapeWriter[][src]

pub struct ShapeWriter<T: Write + Seek> { /* fields omitted */ }

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]

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]

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]

pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, Error>[src]

Creates a new writer from a path. Creates both a .shp and .shx files

Examples

let writer = shapefile::ShapeWriter::from_path("new_file.shp");

Trait Implementations

impl<T: Write + Seek> Drop for ShapeWriter<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for ShapeWriter<T> where
    T: RefUnwindSafe

impl<T> Send for ShapeWriter<T> where
    T: Send

impl<T> Sync for ShapeWriter<T> where
    T: Sync

impl<T> Unpin for ShapeWriter<T> where
    T: Unpin

impl<T> UnwindSafe for ShapeWriter<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.