Module shapefile::reader[][src]

Reader module, contains the definitions of the types that a user should use to read a file

Reader

The Reader is the struct that actually reads the different files that make up a shapefile.

Examples

When reading from a file:

Creates a reader from a path, then iterate over its Shapes, reading one shape each iteration

let mut reader = shapefile::Reader::from_path("tests/data/multipatch.shp")?;
for shape_record in reader.iter_shapes_and_records() {
    let (shape, record) = shape_record?;
    println!("{}", shape);
}

ShapeReader

If you only care about the geometries stored in the .shp file, whether or not the .dbf file actually exists, you can use the ShapeReader.

Extra

If you know beforehand the exact type that the .shp file is made of, you can use the different *_as::<S>() methods.:

Otherwise use the functions that return Shapes and do a match

One liners

Some ‘one liner’ functions are provided to read the content of a shapefile with one line of code

Structs

Reader

Reader that reads a shapefile.

ShapeIterator

Struct that handle iteration over the shapes of a .shp file

ShapeReader

This reader only reads the .shp and optionally the (.shx) files of a shapefile.

ShapeRecordIterator

Functions

read
read_as
read_shapes

Function to read all the Shapes in a file.

read_shapes_as

Function to read all the Shapes in a file as a certain type