2

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...

3
  • Please add the invalid geometry as WKT.
    – user30184
    Commented Mar 27, 2023 at 13:23
  • Could you put the invalidid geometry into some download service? What error did the Check validity tool write into the Error output layer?
    – user30184
    Commented Mar 27, 2023 at 15:11
  • 2
    rounding of precise values can cause geometry errors
    – nmtoken
    Commented Mar 27, 2023 at 16:18

1 Answer 1

0

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.

3
  • I'm facing the same problem. I did a pure gdal command line to fix them. <ogr2ogr -f GeoJSON gamingarea.geojson -t_srs "EPSG:4326" "server.com/map/…" -nlt MULTIPOLYGON -makevalid> Did you find finally a solution with FME Server?
    – jlSta
    Commented Feb 19 at 10:39
  • I solved this issue in FME by a donut extraction, linking the both ports to an aggregator transformer with group processing by id, aggregation mode: Geometry Assemble One Level, aggregate type : Homogeneous. Finally, i have a Multipart in place of a donut. So the second part is not considered as hole. If it solves, let me know and i post it as an answer. Thanks
    – jlSta
    Commented Feb 19 at 11:11
  • Another FME Solution is to use the Generalizer transformer, with the Algorithm set to McMaster and Displacement Percentage set to 99. This seems to fix the issue. For ESRI users, ArcGIS Pro, has Repair Geometries. By setting Validation Method to OGC, this also fixes the Issue. Commented Apr 16 at 14:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.