geometry validations

class ValidationError[source]

ValidationError() :: Exception

Common base class for all non-exit exceptions.

class BaseValidator[source]

BaseValidator(add_new_column:bool=True, apply_fix:bool=True) :: ABC

Abstract Base Class for single validator

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

BaseValidator.validate[source]

BaseValidator.validate(gdf:GeoDataFrame, clone=True)

Method that checks the validity of a each geometry and applies a fix to these geometries or raise a warning

Type Default Details
gdf GeoDataFrame GeoDataFrame to validate
clone bool True Apply validation to copy

class OrientationValidator[source]

OrientationValidator(add_new_column:bool=True, apply_fix:bool=True) :: BaseValidator

Checks and fixes Orientation of the geometry to ensure it follows a counter-clockwise orientation

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

OrientationValidator.check[source]

OrientationValidator.check(geometry:BaseGeometry)

Checks if orientation is counter clockwise

Type Default Details
geometry BaseGeometry Geometry to validate

OrientationValidator.fix[source]

OrientationValidator.fix(geometry:BaseGeometry)

Fixes orientation if orientation is clockwise

Type Default Details
geometry BaseGeometry Geometry to fix

class CrsBoundsValidator[source]

CrsBoundsValidator(add_new_column:bool=True, apply_fix:bool=True) :: BaseValidator

Checks bounds of the geometry to ensure it is within bounds of the crs

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

CrsBoundsValidator.get_check_arguments[source]

CrsBoundsValidator.get_check_arguments(gdf:GeoDataFrame)

Return check arguments

Type Default Details
gdf GeoDataFrame GeoDataFrame to check

CrsBoundsValidator.check[source]

CrsBoundsValidator.check(geometry:BaseGeometry, gdf:GeoDataFrame)

Checks if polygon is within bounds of crs.

Type Default Details
geometry BaseGeometry Geometry to validate
gdf GeoDataFrame GeoDataframe to check

CrsBoundsValidator.fix[source]

CrsBoundsValidator.fix(geometry:BaseGeometry)

No fix available

Type Default Details
geometry BaseGeometry Geometry to fix

class SelfIntersectingValidator[source]

SelfIntersectingValidator(add_new_column:bool=True, apply_fix:bool=True) :: BaseValidator

Checks bounds of the geometry to ensure it is within bounds or crs

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

SelfIntersectingValidator.check[source]

SelfIntersectingValidator.check(geometry:BaseGeometry)

Type Default Details
geometry BaseGeometry Geometry to check

SelfIntersectingValidator.fix[source]

SelfIntersectingValidator.fix(geometry:BaseGeometry)

Fix intersection geometry by applying shapely.validation.make_valid

class NullValidator[source]

NullValidator(add_new_column:bool=True, apply_fix:bool=True) :: BaseValidator

Checks bounds of the geometry to ensure it is within bounds or crs

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

NullValidator.check[source]

NullValidator.check(geometry:BaseGeometry)

Checks if polygon is null

Type Default Details
geometry BaseGeometry No Content

NullValidator.fix[source]

NullValidator.fix(geometry:BaseGeometry)

No fix available

Type Default Details
geometry BaseGeometry Geometry to fix

class AreaValidator[source]

AreaValidator(add_new_column:bool=True, apply_fix:bool=True) :: BaseValidator

Checks area of the geometry to ensure it greater than 0

Type Default Details
add_new_column bool True Add new column to show errors
apply_fix bool True Update geometry

AreaValidator.check[source]

AreaValidator.check(geometry:BaseGeometry)

Checks if area is greater than 0

AreaValidator.fix[source]

AreaValidator.fix(geometry:BaseGeometry)

No fix available

Type Default Details
geometry BaseGeometry Geometry to fix

class GeometryValidation[source]

GeometryValidation(gdf:GeoDataFrame, validators:Sequence[typing.Union[str, geowrangler.validation.BaseValidator]]=('null', 'self_intersecting', 'orientation', 'crs_bounds', 'area'), add_validation_columns:bool=True, apply_fixes:bool=True)

Applies a list of validation checks and tries to fix them

Type Default Details
gdf GeoDataFrame GeoDataFrame to validate
validators typing.Sequence[typing.Union[str, geowrangler.validation.BaseValidator]] (null, self_intersecting, orientation, crs_bounds, area) Validators to apply
add_validation_columns bool True Add column to show errors
apply_fixes bool True Update geometry

GeometryValidation.validate_all[source]

GeometryValidation.validate_all()

Sequentially run validators