1

This question is based on another one that found only a partial solution (workaround) - but there should be a better solution, I'm convinced. However, I'm stuck. Here is what is already clear:

In an atlas, you can get for each page of the atlas output a list of the elements (say: towns) on this particular atlas page - a list of the towns that appear on this particular atlas page. So for every page you get a list of the towns that appear on this particular atlas page.

Now here is the question:

How is it possible compose (let's say on a separate layout-page) all features (all towns) and list them together with the no. of the atlas page they appear on? In the most simple case you have one layer towns and one layer rectangular polygons, the last one is the one that creates the atlas pages.

As a starting point I thought about using an expression used on the towns-layer, based on intersects( $geometry , @atlas_geometry ), however I'm not sure how to integrate the page-no. The variables @atlas_featurenumber and @atlas_featureid can both be used to refer to the current page-no on each individual atlas-page, but i don't see how it could be used the refer to all the pages (not just the current one) in a separate list. I thought of using an array, but I'm stuck with how to set it up and use it accordingly. Final aim is to create a register of all towns that lists the page-no. of the atlas on which they appear, like:

town a page 4

town b page 7

town c page 19

town d page 4

2

Maybe I'm missing something here but wouldn't this be a simple spatial join?

If you have one page per atlas feature, you could generate a page number as a column in the atlas layer based on the desired sort order for your atlas, using one of the renumbering approaches outlined here.

Then it's just a matter of a regular spatial join of the page number to the towns, I imagine - either permanently or using aggregate() expression in field calculator in the attribute table like below:

aggregate('atlas_layername',
          'concatenate',
           to_string("atlas_attribute"),
           intersects($geometry,
                      geometry(@parent)),
           ',')

enter image description here


The limitations are that you need to change the expression if you

  • change the order of your atlas pages
  • add a filter to your atlas
  • have maps covering a larger area than the atlas feature extent (e.g. using margin around feature, or a buffer) - so there are features visible in atlas page 1 that are not actually within the atlas feature itself.

So it doesn't really look at the atlas features themselves. But for the original question you linked to the above should suffice.

2
  • Perfect, this is what I was looking for, thanks. The last of your three limitations can be resolved by using a bounding box with the expression make_rectangle_3points( make_point(x_max( $geometry), y_max($geometry)), make_point(x_min( $geometry), y_max($geometry)), make_point(x_min( $geometry), y_min($geometry))) and maybe a buffer added to that with buffer( geometry, distance).
    – Babel
    May 22 '20 at 15:48
  • 2
    yes, you could even use bounds($geometry). It may take some trial and error to figure out how much distance to buffer by.
    – she_weeds
    May 22 '20 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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