What I've got:

1: A vector-layer with administrative areas of my country

2: A raster-layer with the slope of the terrain of the same country (it is derived from SRTM elevation data with QGIS)

What I want:

A new vector-layer with the 'flat' land of all administrative areas.

How do I achieve this in QGIS?

A) How to extract the area below a certain slope (in the raster-layer)? - The option for rule-based display is not available (maybe this is just there for vector-layers).

B) How to 'intersect' the flat-land-raster-layer(-mask) with my admin-vector-layer?


A) Actually the "Clip to MinMax" with an appropriate set Min- and Max-value (e.g. Min: 10, Max: 100 - or inverse Min: 0, Max: 10.1) does the job. Now I want to use this as a 'clipping-mask' for my vector-layer, but how?


In QGIS you can use the gdal_polygonize.py function available through the menu Raster > Conversion > Polygonize (raster to vector). Once you have created the new polygon shapefile, then filter the data by slope. Next, delete the non-"flat" features from the shapefile by selecting them based on the slope values.

You can use the Vector > Geoprocessing Tools > Symmetrical difference tool to cut the remaining slope polygons along political boundary lines.

Of course, there are likely to be places where steep terrain is present in an otherwise predominantly flat region. I think your definition of "vector layer with the 'flat' land of all administrative areas" covers this issue, though.

There is a handy video on youtube about converting a raster to a set of polygons.

  • "Next, delete the non-"flat" features from the shapefile by selecting them based on the slope values." I'm struggling with this. Before I just set them to 'transparent' which causes - obviously - problems. – Chrugel Dec 28 '12 at 14:57
  • Aaah - never mind. Steep-land-areas are removed now, I am just struggling with the clipping because of projection-issues - but I am getting there! – Chrugel Dec 28 '12 at 15:22
  • That's great to hear. Cheers! – katahdin Dec 28 '12 at 16:29

I wanted to share my exact procedure:

1 While calculating the slope out of the elevation-data (SRTM) play with different 'Z'-values [Raster > Terrain analysis > Slope]

2 Reproject the raster-layer to the same type as the vector-layer [Raster > Projection > Transformation]

3 Extract the points above/below the wished threshold with the Raster calculator [Raster > Raster calculator ...]

4 Convert the threshold-raster-layer into a vector-layer [Raster > Conversion > Polygonize]

5 Open the Attribute table of the new layer and search for either 0 or 1 and delete them all at once

6 Intersect the two vector-layers in the desired manner (intersect or difference) - [Vector > Geoprocessing Tools > Intersect/Difference]

comment: This way (with the Raster calculator) it is very easy to combine several raster-layers and get a combined 'clipping-mask' for the vector-layer - with just ONE computational intense step of Polygonization and Intersection.

In my case I combined altitudes above 1500m and steep slopes and now I've got all the lowland-flatland parts of all administrative areas (very close to the real settlement area).


Just wanted to add this tutorial for using the raster calculator to get the thresholds. http://spatialgalaxy.net/2012/01/25/using-the-qgis-raster-calculator/

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.