QGIS Vector Geometries – How to Validate Vector Geometries to OGC Standards

geometriesogcpolygonizeqgisvector

I'm currently using FME to validate geometries, coming from 3rd parties, making sure there to OGC Standards.

I was hoping to be able to replicate these checks in QGIS, but find the tools available (Check Geometries Plugin, Topology Checker and Check Validity) do not currently flag the issues to the same degree as FME. We need a way these 3rd Party's can check the geometries and find the issues, before sending them onto us, but preferably through QGIS.

Currently, FME is flagging an issue Hole Outside of Shell. Indeed, when I check the datasets with the issue and show/label the vertices it shows the problem

Hole outside shell

Is anyone aware of a more rigorous tool/plugin preferably open source, which can be used to check validity of Geometries to OGC standards? Or alternatively, does anyone have a way I can do this in QGIS?

WKT

POLYGON ((316090 271359.55790742964,316090 271358,316094 271358,316094 271350,316098 271350,316098 271342,316102 271342,316102 271338,316106 271338,316106 271334,316104 271334,316104 271332.59936407575,316078.7082847951 271332.5992296712,316078.7993720204 271359.55784790637,316090 271359.55790742964),(316092 271350,316092 271348,316094 271348,316094 271350,316092 271350),(316100 271338,316100 271336,316102 271336,316102 271338,316100 271338))

Typical though, the extracted WKT doesn't have the issue, the geometry string exceeds the character limit for the post, so I had to clip it, evidently in clipping it, and converting it to WKT, the issue was addressed…

Best Answer

Unfortunatly the dataste im working on has in excess of 1.5 million polygon geometries and I cant share it as its also sensative information. My access to download services is also restricted, as is access to those by 3rd Parties.

I have found a way to validate the data, which may work as a starting point. using a Bath Script in Windows, I can run the following

@echo=off
for %%f in (*.shp) do (
ogrinfo -sql "ALTER TABLE %%~nf ADD COLUMN validity character(60)" %%~nxf
ogrinfo -dialect sqlite -sql "UPDATE %%~nf SET validity = (ST_IsValidReason(Geometry,0))" %%~nxf 
)    
pause

This adds a new column to the data which runs as close to a OGC validation as I can determine.

Any ideas on how this might be developed or improved are welcome.

Related Question