I have a polyline that I split in 5000 m sections and I made it to generate an Atlas for the first step, but since the sections that I want to show are long and not wide I would like to add sections, e.g. Atlas Map page1 shows section 1 and 2 (instead of the same green section1, the second panel should show orange section2. see picture with the 2 panels: I tested filtering the Atlas, but I got stuck and wasnt sucessfull. I created 2 virtual layers containing every second section, but after I added the second panel I could not find out if it is possible to let the panels be controlled by different layers for Atlas generation. Any idea how to get 2 panels with continuing sections?


1 Answer 1


You can do that like here:

  1. Add xmin/xmax/ymin/ymax to each feature of your atlas layer. Your can do it with the function:


enter image description here

  1. Control your atlas by extentension, defining a functions inside thouse xmin/xmax/ymin/ymax in composer (here, as you can figure it out, that -0.002 creates an small margin around the feature):

attribute (get_feature( 'Atlas', 'id', @atlas_featurenumber +1) , 'xmin') -0.002

enter image description here

If you use this system don't mark "controlled by atlas".

Be creative and you will get a perfect atlas.



Select the square of map --> properties --> extension --> xmin/xmax/ymin/ymax: edit... (sorry, my QGIS is in spanish, but can get the position):

enter image description here

If you write the function properly you will get the xmin/xmax/ymin/ymax value of the desired feature of your atlas:

enter image description here

Same for each xy of square 2: Here "+1" means "go to the following feature from your atlas layer". Do the same for each xmin/xmax/ymin/ymax and adapt the function.

enter image description here

Update to avoid repeated features:

Here is the code for the upper map xmin:

when @atlas_featurenumber = 1 then  attribute (get_feature( 'Atlas', 'id', 1),'xmin')
when @atlas_featurenumber = 2 then attribute (get_feature( 'Atlas', 'id', 3),'xmin')
when @atlas_featurenumber = 3 then attribute (get_feature( 'Atlas', 'id', 5),'xmin')
when @atlas_featurenumber = 4 then attribute (get_feature( 'Atlas', 'id', 7),'xmin')
when @atlas_featurenumber = 5 then attribute (get_feature( 'Atlas', 'id', 9),'xmin')
when @atlas_featurenumber = 6 then attribute (get_feature( 'Atlas', 'id', 11),'xmin')
when @atlas_featurenumber = 7 then attribute (get_feature( 'Atlas', 'id', 13),'xmin')
when @atlas_featurenumber = 8 then attribute (get_feature( 'Atlas', 'id', 15),'xmin')
when @atlas_featurenumber = 9 then attribute (get_feature( 'Atlas', 'id', 17),'xmin')
when @atlas_featurenumber = 10 then attribute (get_feature( 'Atlas', 'id', 19),'xmin')

This code allows you to go from feature 1 to 3 to 5... in the upper square. Do the same for xmax/ymin/ymax. Then copy the code, go to lower map and paste it replacing those 1,3,5... by 2,4,6... As you may have noticed this code allows you to create a consequent map with 10 pages as much. If it has more page, you just need to add lines with the same logic. enter image description here

And if you have odd number of segments you can make invisible the lower map by, also, adding a function to make it transparent like (when Atlas feature is null then make it 100% transparent): enter image description here

  • 1
    I was in the process of writing the exact same answer, you beat me to it.
    – Gabriel
    Feb 11, 2019 at 16:36
  • Sorry mate. Anyway, post your answer if you find a finest path to do it. Feb 11, 2019 at 17:00
  • 1
    Thanks a lot César, that sounds brilliant, but I have problems to follow, sorry. Step1 is clear. I added xmin/xmax/ymin/ymax in my Attribute table. but step2...."Control your atlas by extentension" here I am a little bit puzzled. In my Atlas generation tab I still choose my layer for generating the atlas, right? underneath it I could check "filter" or "sort" is this on of the windows where I input "attribute (get_feature( 'Atlas', 'id', @atlas_featurenumber +1) , 'xmin') -0.002"? No, right? I am not sure where I put this.
    – user106879
    Feb 12, 2019 at 9:51
  • I hope now you repeat the process for each extension coords and map square. Regards. Feb 12, 2019 at 11:24
  • 1
    Perfect. It works now roughly. First it did not, because I also told the map to rotate according to an attribute. I just start understand the single expressions in the expression string you gave (sorry this is quite new for me). So I added in Map rotation that it should also take the next rotation angle. Also I had some trouble with scale first. All solved. Thanks again for all your effort, I would have never get these ideas on my own. Altas page 1 is perfekt showing section 1 and 2, but on page 2 is currently section2 and 3. I dont want duplicates. Here section 3 and 4 should shown.
    – user106879
    Feb 12, 2019 at 14:32

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.