Skip to main content

How to Remove Holes in Polygon

Learn the steps to identify and eliminate interior holes from polygon geometries

Rifqi Sentosa avatar
Written by Rifqi Sentosa
Updated over 4 months ago

Introduction

In the context of farm plots, polygons with holes can represent an unusual and often problematic scenario. Farm plots are typically continuous, bounded areas of agricultural land. Holes within these polygons might arise from data errors, such as misaligned boundaries, incomplete digitization, or overlapping datasets.

In most cases, it does not make sense for farm plots to have holes because they disrupt the representation of usable land area and can lead to significant issues in spatial analysis. These issues include inaccurate calculations of plot size, inefficiencies in resource allocation models, and errors in land-use classification.

This documentation explains how to remove holes from polygons using QGIS, a popular open-source geographic information system. If QGIS is not yet installed in your machine, read this resource by QGIS to install the application.

This tutorial is made using MacOS machine. Other OS users may be able to follow along without significant differences.

In the Meridia Verify portal, data with spikes are indicated by the risk profile for GET07 (Farm plot polygon contains holes) test.


Import the Polygon to QGIS

This section provides a comprehensive documentation to importing files into QGIS for further processing. This step explains how to bring this data into QGIS, a popular open-source GIS tool.

To start importing the file, launch QGIS from your Start menu or desktop icon.

In QGIS, to start the import process, go to Layer menu > Add Layer > Add Vector Layer

A Data Source Manager window will be opened. Using this window, the data is imported into QGIS. In this tutorial, the data to import is in KML file format, which is one of the most used geospatial data formats. If your data is in file formats, you can also follow along this step without any additional or different steps.

Using the popped-up Data Source Manager window, the data can be imported.

  1. Select File as Source Type.

  2. Click on the button to browse the KML file (or any other file format).

Navigate into your data folder.

  1. Select the KML file(s) to import.

  2. Click on Open button.

After selecting the files, click Add button to finish the import.

The Data Source Manager window will close to show the imported file(s) on the map in QGIS main window at the center, as well as in the Layers pane on bottom-left of QGIS window as KML group containing the vector layer. However, for other file format, you may see the imported data as single layer instead of KML group, which simplify things even more.

If the imported file does not shown on the map, in the Layers pane, right-click on the imported file > Zoom to Layer (or Zoom to Group)

To modify the visualization of the polygon, Double-click the layer > Symbology > Single Symbol > Color. Click OK after finished.


Remove Holes from Polygon

After the polygon with holes has been shown on the QGIS main map view, the next step is to activate QGIS Processing Toolbox panel which contains various tools for geospatial needs. To remove holes from polygon layer, the tool called “Delete Holes” will be used.

  1. Click on the Tools button on the Toolbar Pane, which will show a new pane called Processing Toolbox.

  2. Search for Delete Holes tool in the Processing Toolbox panel.

  3. Double-click on Delete Holes tool to open its tool window.

On the Delete Holes window, the processing to remove the holes from the polygon can be configured.

  1. Select the polygon layer to be processed.

  2. Specify the maximum area of holes that will be removed. To remove all holes, set this parameter as 0.

  3. Click Run to start the process.

After the processed has been finished, the Delete Holes processing window can be closed. A new layer will be shown on the QGIS main map view which is the result of the process.

Observe the result layer to ensure the process run successfully as specified.


Export the Result Polygon

After the result is as specified, the result can be exported into preferred file format.

  1. Right-click the result layer > Export > Save Feature As …

  2. Specify the file format for the result to be stored. In this tutorial, shape file (.SHP) is selected, which is geospatial file format with the most compatibility, including compatibility with Meridia Verify portal.

  3. Specify the directory and the name of the result file. Click on the button on the left to browse the preferred directory.

  4. Click OK to finish the export. You can open the directory to find your exported file.


Conclusion

In summary, removing holes of your polygons might be very important for your case to make your data represent the reality as close as possible. Using this tutorial, you will have a polygon without holes that is ready to be uploaded into Meridia Verify portal.

We encourage users to use this tutorial for different scenarios to get familiar with QGIS and with the process itself which will help you in other geospatial data engineering issues and problems in the future.

Please refer to additional resource below to get more information regarding this tutorial.


Additional Resource

Did this answer your question?