In my project I have a vector layer and a raster layer. I want to remove all features of the vector layer where the feature's location has a height value of 0 in the same location in the raster layer.
This works fine by using "Select by expression" and using the below expression:
raster_value('layerid' ,1,make_point(x($geometry),y($geometry))) = 0
and then replacing 'layerid'
with the ID of the raster layer.
I want to automate a lengthy workflow with the graphical modeler, where this is one of the tasks.
I'm trying to use "Extract by expression", with the same expression as above, and it works as long as the layerid
parameter is changed prior to running the model, however I want to use the raster layer input heightmap
to get the ID. Like so:
This isn't working. The expression returns null every time. I've tried using eval(@heightmap)
, as well, but no luck.
As an attempt of a workaround I have tried to use "Load layer into project" algorithm, and then using it's output variable in the expression, but this did the same.
How can I put the layerid of the heightmap
input into the expression properly?
map layers
? Usually there's a lot of numbers after the layer name.