3

In QGIS, I have a layer of polygons which represent forested area, captured from an old paper map, that I have converted from polylines. See my screenshots below. The forest area has holes in its coverage. The polylines defined the edges of those holes. Unfortunately, the conversion from polylines, which I did in QGIS using Vector > Geometry Tools > Lines to polygon, cannot be configured to sense that a nested polygon must be a hole within the larger polygon. It simply filled all closed polylines regardless of nesting.

To manually cut the holes, I have tried to use the ‘Add Ring’ feature on the Advanced Digitizing Toolbar. This has not worked for me. So here are my questions:

1). Is there a way to ‘Add Ring’ in a larger polygon using an existing smaller polygon as a ‘cookie-cutter’, or must one always use the Add Ring tool by actively drawing a new closed line, vertex-by-vertex, with the tool’s cursor?

2). Is there a way to cut a bunch of such holes in one single operation, perhaps by dragging a selection box over a wider area and applying the cutting operation to all polygons within it?

3). If neither these processes are possible, can someone suggest another workflow to achieve the same thing within QGIS, or else confirm that QGIS is unable to do this.

This topic has not been answered fully here before. There is a GIS StackExchange thread How to create a hole in a polygon in QGIS? which neither discusses how to use an existing polygon to cut a hole in a larger polygon, nor does it offer any way to cut many holes at once. It does not answer my question. I am asking a new question here.

Finally, I wouldn't want anyone to get hung up on the specifics of this example, so I better say that although you might inspect my screenshot of the forest cover on the original map cover and see it has few 'donut holes', the raster conversion had to contend with a lot of noise, so that the resulting vectors tended to join up and have far more donut holes. None of these little details are essential to the general questions I'm asking above.

Screenshots:

1. Portion of the georeferenced paper map showing forest cover Portion of the georeferenced paper map showing forest cover

2. Polylines created from an edge-detected raster to vector conversion Polylines created from an edge-detected raster to vector conversion

3. Polygons created by QGIS ‘Lines to polygon’ command Polygons created by QGIS ‘Lines to polygon’ command

4

If I have understood your problem properly I suggest you the fallowing steps:

  1. Make a rectangular polygon the cover all your old paper map and call it a.shp
  2. select from your previous work all the polygones that must make holes in te rectangle and save them all in another shape and call it b.shp
  3. In vector menu use the geoprocessing function called "difference" and use as input a.shp and as difference b.shp > now you have the a.shp with holes from b.shp > call this layer c.shp
  4. In vector menu use the geoprocessing function called "union" and use c.shp and b.shp I hope it'll help you
  • Thanks @Richard Sharpe, as you recommended the command Processing Toolbox > Vector general > Delete duplicate geometries did the job. There was a fair bit of cleaning up though because there is no option to delete the polygons in the difference layer if and when they had created holes in the background layer. So that had to be done manually. But at least the command did the most important task. – IanS May 13 '18 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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