0

I am using QGIS 3.10.

I hope to obtain sample expressions for printing each visible layer of a project using Print Layout's Atlas functionality

Based on @Erik's comments on another question (about changing QGIS behavior), I'm trying to follow through on setting up printing an "atlas."

The dialog (below) is imposing for a neophyte. The first reference returned from a search on 'atlas' in the QGIS docs is to an Example, which nevertheless is enough different from my scenario as to not shed light.

It focuses on using a vector layer composed of an array of rectangles to print a set of smaller maps covering a single layer.

In my application, I wish to use a layer with a single rectangle to print a set of maps for the same region from each of a set of 4 layers. (@Erik had also suggested perhaps using a Map Theme to reference all the visual layers, but I do not find any reference to a map theme among the items available in "Expressions.")

Beyond opening Atlas->Settings in Print Layout, selecting "Generate an atlas", choosing my "Coverage layer" (with the vector layer containing my polygon), and hiding that coverage layer (so the polygon won't print on the outputs), I'm lost.

In particular, I'd like to know how to fill out:

  • Configuration->PageName, ->FilterWith, and ->SortBy fields
  • Output->OutputFilenameExpression field.

I'd also like to know how to get a list of the visible layers and how to step through them in Expressions Dialog (which comes up when clicking on the side-button of the PageName field).

If using a map theme is the way to go, how is it referenced in the Dialog?

atlas dialog

0

1 Answer 1

2

This solution here is kind of a hack, there might be better solutions: If you want to use a grid of rectangles (polygons) and print a separate map-page for each rectangle, set this rectangles-layer as coverage layer in your atlas generation tab (your screenshot).

To have four different maps with each showing a different layer for every rectangle, than create 4 pages in you atlas layout (create one page with the map and than add more pages and copy/paste the elements of the first page). Than on each site set another map theme that your map element should follow. You have to define first these four map themes in the QGIS main window - create four map themes with each showing just one layer.

Another hack, maybe a little bit more elegant: duplicate the rectangles in your coverage layer so that you have four times the same rectangles in the same layer. Than define the four map themes. In the layout, you now have to create just one page for the atlas. For the map theme, use a data driven override with an expression like this:

if ((@atlas_featurenumber  % 4 =0),
        'theme_4', 
       if ((@atlas_featurenumber  % 3 =0),
               'theme_3',
               if ((@atlas_featurenumber  % 2 =0),
                      'theme_2',
                          'theme1')
))
0

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.