shapelib.exceptions package#
Custom exceptions for shapelib.
Submodules#
shapelib.exceptions.geometries_exceptions module#
- exception shapelib.exceptions.geometries_exceptions.InvalidGeometryError(message='Invalid geometry could not be validated or fixed.')[source]#
Bases:
ExceptionException raised when invalid geometries cannot be validated or fixed.
This error is raised when a geometry, such as a shapefile or GeoDataFrame geometry, is found to be invalid and cannot be corrected using the available validation methods (e.g., make_valid in Geopandas or Shapely).
- Variables:
message (
str) – The error message describing the nature of the invalid geometry.- Parameters:
message (str)
Examples
>>> if not geometry.is_valid: >>> raise InvalidGeometryError("The geometry is invalid and cannot be fixed.")
shapelib.exceptions.transformation_exceptions module#
- exception shapelib.exceptions.transformation_exceptions.DatumTransformationError[source]#
Bases:
ValueErrorException raised when coordinates cannot be transformed with the best accuracy known.
shapelib only transforms coordinates with the best transformation PROJ knows between two CRSs. It refuses to fall back to a less accurate one — such as a formula used when the official correction grid is not installed, or a “ballpark” transformation that ignores the datum shift when the datum is unknown — because a fallback moves the data by metres without any warning.
Subclasses
ValueError, so code that already catchesValueErrorfor CRS problems keeps working.Examples
>>> try: ... lines = read_file("nad27_lines.shp") # NAD27 needs a US grid not bundled ... except DatumTransformationError as error: ... print(error)