I'm trying to get a clean vector layer from an elevation raster layer. I'm using Raster > Extraction > Contour... to get lines from the elevation raster here:

enter image description here

This tool produces this layer (I kept only one elevation level to keep it simple here):

The lines produced by Contour

I'm then using Vector > Geometry tools > Lines to polygons to transform these lines into polygons and it produces this result:

enter image description here

The problem is: All the parts which are below the main elevation contour are filled. But those should be holes in the main polygon.

enter image description here

How can I get the polygon with the holes?


I found a solution by using the Polygonize tool instead of the Contour one. This process is quiet slow though.

First, I use the Raster Calculator to isolate each level I want to show. Then I use the Polygonize (raster to Vector) and filter the level I want (in my case, 1). Then Vector geometry tools > Simplify geometry and finally the Smooth geometry tool.

It gives me this nice vector: enter image description here

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.