2

When creating an atlas in QGIS, is it possible to filter map feature visibility based on the coverage layer?

What I want:

Using the image below, I want to hide the orange polygons and display only the polygons that are either intersected by the black 'coverage layer' feature or whose ID is in the coverage layer's attribute ID_LIST. The ID_LIST is a string of comma-separated numbers with no spaces.

enter image description here

What I have tried:

Using rule-based visible/else hide styling, for the 'visible' filter I've tried the following rules:

array_contains(string_to_array(attribute(@atlas_feature, 'ID_LIST' )),to_string("ID"))

The above did not work.

array_find(aggregate(layer:='MULTICOLORED_POLY', aggregate:= 'array_agg', expression:=ID, filter:=intersects( @atlas_geometry , $geometry)),"ID")

This one rendered all features.

1 Answer 1

1

My atlas feature shares a PID with the BLACKPOLYGON feature. In my final solution the black polygon feature happens to contain the features being symbolized not intersect as shown above. I suppose substituting 'intersects' for 'contains' below would satisfy the case shown above as well.

contains(geometry(get_feature('BLACKPOLYGON','PID',attribute( @atlas_feature,'PID'))), $geometry)

Your Answer

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

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