2

In my QGIS atlas, I need to display 4 different pictures for each current feature.

My coverage layer is "features". "features" is linked by a 1 to many relationship with my "photos" table

The "path" to each pictures is stored in a "path" field of my "photos" table

in my "photos" table, the field "atlas_photos" contains values from 1 to 4.

In my atlas :

  • in my photo 1 rectangle, in the expression builder for the filepath I'm trying to get the "path" value in my "photos" table where "atlas_photos"='1' for the current atlas feature

  • in my photo 2 rectangle, in the expression builder for the filepath I'm trying to get the "path" value in my "photos" table where "atlas_photos"='2' for the current atlas feature

and so on...

I tried to do this using a simple relation aggregate but there is no "filter" parameter.

if I use relation_aggregate('featurestophotosrelation',aggregate:='concatenate',expression:="path",concatenator:=';', order_by:="atlas_photos"='1')

I don't understand the order of the results wich is not sorting the aggregate by 1, 2 ,3 and so on

7
  • "atlas_photos"='1' is likely returning false for all cases ('1' is a string an your values appear to be numeric), and is therefore nonsensical for sorting. You will likely have more success with order_by:="atlas_photos" which will yield a numeric value.
    – Matt
    Commented May 17, 2023 at 16:21
  • with "atlas_photos" as a int. using "atlas_photos"='1' or "atlas_photos"=1 or 2 or 3 doesnt change anything in the result. I always get the same order in the aggregate.
    – tonyduky
    Commented May 18, 2023 at 5:12
  • Use only order_by:="atlas_photos. Not = 1 etc. When you use = (something) you get a boolean as the result of the expression. Using order_by:="atlas_photos" will yield the number itself that is associated with the current feature.
    – Matt
    Commented May 18, 2023 at 5:16
  • i actually solved it using "atlas_photo"='1'. This puts the desired value at the end of the aggregate. Thankfully my paths are the same lenght so i was able to right() the desired result. I repeated the same thing with "atlas_photo"='2', "atlas_photo"='3' and so on for the different photos rectangles.
    – tonyduky
    Commented May 18, 2023 at 5:47
  • I dont understand why i can't use concatenator and order by in the same relation_aggregate though.
    – tonyduky
    Commented May 18, 2023 at 5:48

0

Your Answer

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

Browse other questions tagged or ask your own question.