TransWikia.com

What is fix geometry actually doing in QGIS?

Geographic Information Systems Asked on March 23, 2021

Sometimes geometry’s have to be fixed for further processing. So you can use fix geometry and it will do the job for you without prompting. But I’m wondering, what the tool fix geometry is really doing.

What kind of geometry errors is it fixing?

3 Answers

As per the OGC Simple Feature Access specification, geometries need to follow the OpenGIS compliance (see the PostGIS docs for quick reference), where (listing only the most prominent predicates)

  • Points are considered inherently valid
  • LineStrings are valid if they are simple, meaning that they don't pass an inner vertex twice
  • Polygons are valid if their linear components are simple and none of their rings cross
  • MultiPoints are valid if no coordinate pair is present twice
  • MultiLineStrings are simple if all their components are simple, and common vertices only touch
  • MultiPolygons are valid if all their components are valid and do not overlap

In order to do so, the internally called GEOS modules will (listing only the most prominent operations)

  • correctly node a LineString and remove consecutive duplicated vertices
  • correctly node the linear components of a Polygon and iteratively rebuild all possible valid areas from them
  • do the above for all parts of their Multi geometries

where noding means breaking apart a linear component at non-consecutive duplicated vertices.

In this context, 'fixing' geometries rather means creating the maximal set of their valid and/or simple parts, and may result in a collection of geometries of different dimensionality.

Correct answer by geozelot on March 23, 2021

I think @Vince's idea is what you can try.

From QGIS Documetation:

Attempts to create a valid representation of a given invalid geometry without losing any of the input vertices. Already valid geometries are returned without further intervention. Always outputs multi-geometry layer.

More details you can find in:

P.S. I hope that @Nyall Dawson will answer this question.


References:

Answered by Taras on March 23, 2021

It is basically fixing your geometry using the makeValid method, that is, correcting your geometry without loosing nodes:

https://qgis.org/pyqgis/master/core/QgsGeometry.html?highlight=qgsgeometry#qgis.core.QgsGeometry.makeValid

similar of the St_MakeValid of PostGIS:

https://postgis.net/docs/ST_MakeValid.html

Answered by matteo on March 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP