geozero_shp/
lib.rs

1#![deprecated(
2    note = "The geozero_shp crate has been deprecated. Instead, use geozero's built-in shapefile feature"
3)]
4
5mod header;
6mod point_z;
7mod property_processor;
8pub mod reader;
9mod shp_reader;
10mod shx_reader;
11
12pub use crate::header::ShapeType;
13pub use crate::reader::Reader;
14pub use crate::shp_reader::NO_DATA;
15
16// Re-export GeoZero to help avoid version conflicts
17pub use geozero;
18
19/// All Errors that can happen when using this library
20#[derive(thiserror::Error, Debug)]
21pub enum Error {
22    /// Wrapper around standard io::Error that might occur when reading/writing
23    #[error("I/O error")]
24    IoError(#[from] std::io::Error),
25    /// The file read had an invalid File code (meaning it's not a Shapefile)
26    #[error("The code `{0}` does not correspond to any of the ShapeType code defined by ESRI")]
27    InvalidFileCode(i32),
28    /// The file read had an invalid [ShapeType](enum.ShapeType.html) code
29    /// (either in the file header or any record type)
30    #[error("The file code `{0}` is invalid, is this a Shapefile?")]
31    InvalidShapeType(i32),
32    /// The Multipatch shape read from the file had an invalid [PatchType](enum.PatchType.html) code
33    #[error("Invalid patch type `{0}`")]
34    InvalidPatchType(i32),
35    /// Error returned when trying to read the shape records as a certain shape type
36    /// but the actual shape type does not correspond to the one asked
37    #[error("The requested type: '{requested}' does not correspond to the actual shape type: '{actual}'")]
38    MismatchShapeType {
39        /// The requested ShapeType
40        requested: ShapeType,
41        /// The actual type of the shape
42        actual: ShapeType,
43    },
44    #[error("Invalid shape record size")]
45    InvalidShapeRecordSize,
46    #[error("Dbase Error")]
47    DbaseError(#[from] dbase::Error),
48    #[error("Dbf missing")]
49    MissingDbf,
50    #[error("Index file missing")]
51    MissingIndexFile,
52    #[error("Geozero error")]
53    GeozeroError(#[from] geozero::error::GeozeroError),
54}