Geometry Validation
ValidationError
Common base class for all non-exit exceptions.
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 |
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 |
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 |
OrientationValidator.check
OrientationValidator.check (geometry:shapely.geometry.base.BaseGeometry)
Checks if orientation is counter clockwise
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to validate |
Returns | bool |
OrientationValidator.fix
OrientationValidator.fix (geometry:shapely.geometry.base.BaseGeometry)
Fixes orientation if orientation is clockwise
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to fix |
Returns | BaseGeometry |
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 |
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 |
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 |
CrsBoundsValidator.fix
CrsBoundsValidator.fix (geometry:shapely.geometry.base.BaseGeometry)
No fix available
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to fix |
Returns | BaseGeometry | pragma: no cover |
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 |
SelfIntersectingValidator.check
SelfIntersectingValidator.check (geometry:shapely.geometry.base.BaseGeom etry)
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to check |
Returns | bool |
SelfIntersectingValidator.fix
SelfIntersectingValidator.fix (geometry:shapely.geometry.base.BaseGeomet ry)
Fix intersection geometry by applying shapely.validation.make_valid
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 |
NullValidator.check
NullValidator.check (geometry:shapely.geometry.base.BaseGeometry)
Checks if polygon is null
Type | Details | |
---|---|---|
geometry | BaseGeometry | |
Returns | bool | Geometry to check |
NullValidator.fix
NullValidator.fix (geometry:shapely.geometry.base.BaseGeometry)
No fix available
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to fix |
Returns | BaseGeometry | pragma: no cover |
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 |
AreaValidator.check
AreaValidator.check (geometry:shapely.geometry.base.BaseGeometry)
Checks if area is greater than 0
AreaValidator.fix
AreaValidator.fix (geometry:shapely.geometry.base.BaseGeometry)
No fix available
Type | Details | |
---|---|---|
geometry | BaseGeometry | Geometry to fix |
Returns | BaseGeometry | pragma: no cover |
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 |
GeometryValidation.validate_all
GeometryValidation.validate_all ()
Sequentially run validators