TransWikia.com

Select the holes in a vector shapefile in QGIS

Geographic Information Systems Asked on January 9, 2021

Is there a way to select the holes (gaps) in a vector shapefile in QGIS, like the "fill holes" function which recognizes them indirectly?
I need to get the holes from the original shapefile and work with them.
Is there a way in other software like Arc?

2 Answers

If you dont mind a two step process:

  1. Run "Delete Holes" from processing toolbox on your "PolygonWithHoles"
  2. Run "Difference" and use your "Cleaned" (Result from Delete Holes) as Input and your "PolygonWithHoles" as Overlay:

enter image description here

Result:

enter image description here

Correct answer by MrXsquared on January 9, 2021

If you wish a one-step solution, you could also use "Geometry by Expression" with this expression:

difference(make_polygon(exterior_ring($geometry)),$geometry)

or a "virtual layer" with this query:

select difference(make_polygon(exterior_ring(geometry)),geometry) from PolygonWithHoles

Both will return a multipolygon of the holes.

Answered by MrXsquared on January 9, 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