This question already has an answer here:

I have a polygon shapefile with holes (representing Islands and Rivers) within it as seen below:

enter image description here

I need an automated way to fill the polygon in QGIS as seen below: That is remove all Islands and divisions within and outside the polygon.

enter image description here

I know I can creating a separate layer and manually digitize the area, but there are many of such polygons.

I tried the following, non worked:

1- Vector > Geometry Tools > Multipart to Singlepart

2- Vector > Geoprocessing Tools > Dissolve

3- Vector > Geoprocessing Tools > Eliminate Silver Polygons

Graphic/image explanation above: What I have is the first image, but what I want is the second image.

Edited: The answer here How to smooth/generalize a polygon in QGIS over generalized the boundaries into straight line (polygon shape deformed) and it does it for separate Island. What I wanted is to eliminate the gaps (Islands) in between and keep the bigger polygon retaining the shape as close as possible.

The shapefile of the image above is here

marked as duplicate by Andre Silva, John Powell, Aaron Jan 7 '17 at 16:07

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What determines where the "short-cut" should go. For example, why leave the small islands on the left side and cut off the parts at the bottom? Alternatively, why did you draw the line at the bottom where you did (as opposed to higher or lower in Y direction)? If you want an automated approach, you need an objective measure / condition. What is that condition? – BradHards Jan 6 '17 at 6:52
  • Pardon my graphics edit am not good with photoshop. My objective measure is simply to have a solid filled polygon nothing more than that. – Umar Yusuf Jan 6 '17 at 7:26
  • The easiest algorithm that will solidify the polygon to resemble the original will be OK, details lose isn't of much concern here. Thanks – Umar Yusuf Jan 6 '17 at 7:32
  • How about a convex hull? – BradHards Jan 6 '17 at 8:09
  • 2
    @BradHards or better still, a concave hull - see my answer – Spacedman Jan 6 '17 at 8:09

A simplification operation should get rid of most of the crinkly bits, but wont join islands to the mainland, and might lose detail at the top of your mainland in this example. You need to set a tolerance for the simplification.

To join everything into one big blob I can think of two possibilities:

First, do a buffering operation so that all the things you want to overlap now overlap, so you'll have to choose a buffer width carefully. Then merge all the polygons, and because they overlap you'll get one feature. Then do a negative buffer of the same size to get back to roughly where you started. There will be some detail loss in places.

Alternatively, look at computing a "concave hull", or alpha shape polygon of your feature. There's some QGIS code here:


This plugin is in the QGIS plugin repo.

Concave hulls still need to be given a tuning parameter so you may be disappointed with the result, but that's just how the mathematics works out.


I had a similar problem, but with the roads,How to fill the empty space automatically, QGIS 2.16.3. You can try to make model like I am. Create your distance buffer + and create buffer - . Maybe this helps you. enter image description here

  • 1
    +1 The buffer -buffer method works well for these types of problems. – Aaron Jan 7 '17 at 5:26

This workaround could solve your problem (don't worry about the length of the answer because it's a really simple procedure).

You only need to convert your polygon to lines and then doing the opposite (you just have to pay "attention" to select a specific output as you will see later).

I'll explain my idea with this sample shapefile (it seems similar to yours):

enter image description here

Firstly, convert the polygon to lines using the Polygons to lines tool from Vector > Geometry Tools (or from the Processing Toolbox):

enter image description here

Then, convert this output to polygons using the Lines to polygons tool from Vector > Geometry Tools (or from the Processing Toolbox):

enter image description here

Once you have done this, you only have to select the area of interest, which is in general the largest one (it's rare the selection of more than one feature but, however, adapt the selection to your specific case):

enter image description here

Save the selected features/s with the Save selected features tool from the Processing Toolbox and you will obtain this:

enter image description here

Finally, this is the overlap of the input file on the output of the last saving operation:

enter image description here

A quick comment: this procedure doesn't apply any simplification, so you won't loss the original level of detail.

  • This sounds interesting, let me give it a try. – Umar Yusuf Jan 7 '17 at 3:01
  • Unfortunately my final result still had openings (holes) in between the larger polygon after following your guide. My shapefile at: dropbox.com/s/0wmhfkii8eosykl/polygon-to-gen.zip?dl=0 – Umar Yusuf Jan 7 '17 at 6:02
  • The guide spitted or explored the polygons but not fill it to form a solid polygon. – Umar Yusuf Jan 7 '17 at 6:04
  • Do you satisfied with any answer? – nagib Jan 8 '17 at 13:18

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