Is there a R or Python solution that 1) checks the geometry validity of vectors and 2) outputs the results in form of a table (see table below). QGIS for example has a nice plugin that carries out several geometry checks. But how can I carry out these checks within a R or Python script?
R there is package
cleangeo for geometry checking and celaning. You can use for example:
library(cleangeo) report <- clgeo_CollectionReport(spatial_object) report #returns a table: type valid issue_type 1 <NA> TRUE <NA> 2 rgeos_validity FALSE GEOM_VALIDITY 3 rgeos_error FALSE ORPHANED_HOLE error_msg 1 <NA> 2 <NA> 3 rgeos_PolyCreateComment: orphaned hole, cannot find containing polygon for hole at index 7 warning_msg 1 <NA> 2 Ring Self-intersection at or near point -120.78997488 38.344996299999998 3 <NA>
for summary you can do something like this:
summary(report) #returns: issue_type GEOM_VALIDITY:1 ORPHANED_HOLE:1 NA's :1