I previously asked this question@ regarding finding files that contain an invalid geometry using OGR.
The following SQL command was suggested to me, which seemed to work a treat: -sql "select * from filename WHERE not ST_IsValid(geometry)"
I am now trying to get this to work under python using the following code:
from osgeo import ogr
driver = ogr.GetDriverByName('MapInfo File')
dataSource = driver.Open(file, 0)
layer = dataSource.GetLayer()
result = dataSource.ExecuteSQL("select * from file WHERE ST_IsValid(geometry)")
featureCount = result.GetFeatureCount()
print (featureCount)
Upon running the code however, I get the following error message: ERROR 1: Undefined function 'ST_IsValid' used.
Does anyone know how I go about checking ST_IsValid
under python?