I'm setting up a graphic modeler to handle three vector layers and one raster layer. In the end, I hope to vectorize the raster and merge the other three into one coverage. The raster file is a slope DEM, and I'm looking for anything steeper than a 25% grade.

I'm pulling my hair out because every time I use the 'select by expression' tool, the next step is to save the selection. Of course it tells me that nothing has been selected. I've tested my expression...

"Shape_Area">2000 AND "DN" = 1 (DN is the binary value attributed to slope < or > 25 degrees)

...outside of the graphic modeler and it works just fine. In debugging, I went back and saved the vectorized file with the $area field calculation included, and the 'select by expression' works just fine.



Use "extract by expression" instead. That will create a new layer with just matching features - effectively the select & save operation in one step. This works well with models too.

  • Effectiveness aside, do you have any insight as to why my approach didn't work? And you we're taking about the 'v.extract' correct? Because it worked like a charm... – user62160 Sep 2 '17 at 14:35
  • @mgallotta - The Extract by expression algorithm is a new tool which can be accessed from QGIS 2.99. Not sure why your expression isn't working but v.extract is a good tool to use :) – Joseph Sep 4 '17 at 9:42

Your Answer

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