5

I have a project with multiple layers. The purple dots are from a pointfile with the symbology-expression: z($geometry)> '14.5'. (so it only displays a purple dot when the Z-value is more than 14.5m).

I have a second layer with polygons, visible as the partly-transparent arc-area in red.

The next step i want to make in my project is to: have the purple dots appear only if: z($geometry)>'14.5' AND the x-y of that spot is within the geographical extent of the polygon from the second layer

What step do i have to take to get this done.

example without last step

1 Answer 1

8

Your question is very similar to what I've done here recently.

I used expression:

if(
within($geometry,geometry(get_feature(layer,attribute,value))),
result_when_true,
result_when_false
)

In your case step 1: filter data table by

z($geometry)> '14.5'

step 2: paste expression in point symbology layer (see gif to find where)

if(
within($geometry,geometry(get_feature('your_polygon_layer_name','the_layers_field','feature_data'))),
1,
0
)

You can use the same expression for labels but must change 1 and 0 values to "label_field_name" and to null.

That's it.

enter image description here

7
  • Good answer! Would it work to drop the if-part completely and just use within(...)? Commented Mar 2, 2019 at 23:41
  • Nope it wouldn't.
    – Dan
    Commented Mar 3, 2019 at 5:28
  • That's surprising... Did you try? Commented Mar 3, 2019 at 7:04
  • Is it possible that this doesn' t work in rule-based symbology? I can get it work in a test environment, but not in my project. I used if( within($geometry,geometry(get_feature('bronpolygonen_4a087198_dafa_4185_a358_d410ed1a980e','TYPECTRL','MONITOR HOOFD VERLICHT'))), 1, 0 ) Commented Mar 4, 2019 at 16:54
  • Or is it possible that my dataset is just to big (626000 features)? Commented Mar 4, 2019 at 17:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.