Tuesday 24 May 2016

qgis - How to Intersect between a vector (administrative areas) and a raster layer (slope)?


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?


Update:


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?



Answer



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.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...