[GIS] How to delete rings automatically using QGIS/Grass

grassqgis

I'm cleaning up a (very) messy shapefile in QGIS/Grass.

I now have several large polygons with numerous (100s) of small rings.

Is there a quick and easy way to remove/ fill all these small rings. Selecting and deleting each one manually is not feasible.

Best Answer

I am assuming that these small rings are "donut holes", or gaps within the polygon (and am mostly writing this for better search result hits, as the title is a bit ambiguous to me).

My solution to this using GRASS GIS is as follows:

# (optional before starting: clean features
v.clean in=original_import out=original_map tool=bpol,rmdup
v.build map=original_map

# 1. Add centroids to the holes
v.centroids in=original_map out=map_with_centroids
# 2. Drop the current table and and one that includes the 
#    areas that now have centroids and a value column that
#    you will use to dissolve the areas
v.db.droptable map=map_with_centroids -f
v.db.addtable map=map_with_centroids columns='value INT'
# 3. Update this "value" column with the same value everywhere
v.db.update map=map_with_centroids col=value value=1
# 4. Now combine the areas by dissolving them together
v.dissolve in=map_with_centroids out=map_noholes column=value

If you rename "original import" to your input map name and "map_noholes" to your desired output map name, you should be able to just copy/paste this block.

Related Question