2

Learning to use aggregates. Need to know how I can list several streets inside my atlas with the condition that layer 1 (not controlling layer, only visualised and used for statistical purposes) and layer 2 (not controlling layer, not visible in atlas) intersect. Layer 1 are points that mark problems, Layer 2 is street network. I want to list all streets with problems present.

This was my attmept:

 aggregate( 
 layer:='Layer 1 reference',
 aggregate:='concatenate',
 expression:="Any attribute",
 concatenator:=', ',
 filter:= 
 intersects(buffer($geometry,5), buffer(

 aggregate( 
 layer:='Layer 2 reference',
 aggregate:='collect',
 expression:="Any attribute",
 filter:= 
 intersects($geometry, geometry(@parent))
 ),
 
 5)
 
 ))

I created a buffer around both geometries so that there is a chance for intersection of these two vector types. Making it larger does not help. The output remains empty. I dont know if I can use aggregate inside aggregate.

If it can be done, then how?

1 Answer 1

4

The buffer in your 7th line can not work because it is not a geometry. The second aggregate collects an attribute, not a geometry.

Try something like this:

 aggregate( 
   layer:='Layer 2 reference',
   aggregate:='concatenate',
   expression:=to_string("Your Attribute"),
   concatenator:=', ',
   filter:=
    intersects(
      buffer($geometry,5),
        aggregate('Layer 1 reference','collect',$geometry)
    )
  )

Make sure the field to concatenate is a string (you can ensure it by using to_string())

3
  • Unfortunately, I cannot seem to make it work. In "Your attribute" I have the street names attribute. The I fill in the references of the layers. No matter the buffer thickness, the result returns empty. Dec 6, 2021 at 22:58
  • Are both layers in the same crs?
    – MrXsquared
    Dec 6, 2021 at 23:29
  • They were not, they are now and now it works. Awesome. Thank you kindly. Dec 7, 2021 at 0:41

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.