Geometry Validation

geometry validations


source

ValidationError

Common base class for all non-exit exceptions.


source

BaseValidator

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

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

source

BaseValidator.validate

 BaseValidator.validate (gdf:geopandas.geodataframe.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
Returns GeoDataFrame

source

OrientationValidator

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

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

source

OrientationValidator.check

 OrientationValidator.check (geometry:shapely.geometry.base.BaseGeometry)

Checks if orientation is counter clockwise

Type Details
geometry BaseGeometry Geometry to validate
Returns bool

source

OrientationValidator.fix

 OrientationValidator.fix (geometry:shapely.geometry.base.BaseGeometry)

Fixes orientation if orientation is clockwise

Type Details
geometry BaseGeometry Geometry to fix
Returns BaseGeometry

source

CrsBoundsValidator

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

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

source

CrsBoundsValidator.get_check_arguments

 CrsBoundsValidator.get_check_arguments
                                         (gdf:geopandas.geodataframe.GeoDa
                                         taFrame)

Return check arguments

Type Details
gdf GeoDataFrame GeoDataFrame to check
Returns dict

source

CrsBoundsValidator.check

 CrsBoundsValidator.check (geometry:shapely.geometry.base.BaseGeometry,
                           gdf:geopandas.geodataframe.GeoDataFrame)

Checks if polygon is within bounds of crs.

Type Details
geometry BaseGeometry Geometry to validate
gdf GeoDataFrame GeoDataframe to check
Returns bool

source

CrsBoundsValidator.fix

 CrsBoundsValidator.fix (geometry:shapely.geometry.base.BaseGeometry)

No fix available

Type Details
geometry BaseGeometry Geometry to fix
Returns BaseGeometry pragma: no cover

source

SelfIntersectingValidator

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

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

source

SelfIntersectingValidator.check

 SelfIntersectingValidator.check
                                  (geometry:shapely.geometry.base.BaseGeom
                                  etry)
Type Details
geometry BaseGeometry Geometry to check
Returns bool

source

SelfIntersectingValidator.fix

 SelfIntersectingValidator.fix
                                (geometry:shapely.geometry.base.BaseGeomet
                                ry)

Fix intersection geometry by applying shapely.validation.make_valid


source

NullValidator

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

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

source

NullValidator.check

 NullValidator.check (geometry:shapely.geometry.base.BaseGeometry)

Checks if polygon is null

Type Details
geometry BaseGeometry
Returns bool Geometry to check

source

NullValidator.fix

 NullValidator.fix (geometry:shapely.geometry.base.BaseGeometry)

No fix available

Type Details
geometry BaseGeometry Geometry to fix
Returns BaseGeometry pragma: no cover

source

AreaValidator

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

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

source

AreaValidator.check

 AreaValidator.check (geometry:shapely.geometry.base.BaseGeometry)

Checks if area is greater than 0


source

AreaValidator.fix

 AreaValidator.fix (geometry:shapely.geometry.base.BaseGeometry)

No fix available

Type Details
geometry BaseGeometry Geometry to fix
Returns BaseGeometry pragma: no cover

source

GeometryValidation

 GeometryValidation (gdf:geopandas.geodataframe.GeoDataFrame,
                     validators:Sequence[Union[str,__main__.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 Sequence (‘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
Returns GeoDataFrame

source

GeometryValidation.validate_all

 GeometryValidation.validate_all ()

Sequentially run validators