When I try to print under QGIS, due to the framing, it prints me 4 pages. Looking more closely, and one by changing the angle of the 2 pages, I am at 2.

How do I automate this?

Current situation: current situation

Hoped-for situation: hoped-for situation


1 Answer 1


You can use the Atlas function in QGIS and select the layer with your features (the blue lines in your example) as coverage layer. Than QGIS prints a separate page for each feature and fits all the features to the page (with the option to define an additional margin).

If you want to create something like a grid, but only get a cell for each feature and one that is oriented in the right direction, use Menu Processing / Toolbox / Minimum bounding geometry, see the output: yellow polygon layer, let's call it cover. This layer will be used in the atlas instead of the grid, where you would need not less than 9 pages.

enter image description here

You can now use this layer cover as cover layer for your atlas, so no empty pages will be created and the features will all fit exactly on the page. To rotate the page, set map roatation to data driven override in the element properties and paste an expression like: 90 - main_angle ($geometry):

enter image description here

And this is the oupupt of the atlas: two pages with features fitting (+1% margin). The north arrow shows you the rotation:

page 1: enter image description here

page 2: enter image description here

page 3: enter image description here

  • I know and I know how to do it in QGIS, the concern is that I have thousands of plans of different natures, my goal is to extract the plans from each SHP, and to chew the ground in QGIS, moreover QGIS uses a grid and only searches for empty boxes, without being able to optimize them cordially Jan 23, 2021 at 7:49
  • I don't understand your problem: you have "plans" - what do you mean with that? Layers? Features? You only want some of the features be shown on a separate page? And what "grid" are you speaking about? And atlas function only searches for "empty boxes"? Sorry, I'm completely confused. Please explain your settings and problem more detailed, ideally add a screenshot to be able to understand the problem.
    – Babel
    Jan 23, 2021 at 9:27
  • You mean you have a grid layer you use as coverage layer for the atlas? You should use the layer containing the shapes you want to show on the atlas page as coverage layer. Than QGIS automatically sets the extent of the page to the extent of the shape.
    – Babel
    Jan 23, 2021 at 9:39
  • Hello, indeed you are right, the concern is that QGIS does not create a grid made up of 4 polygons, to have the extent of the map. In my case, I try to have an algorithm which creates 4 polygons (ex: A4 or A1), totally separated but which would orient itself according to the example map -> the 1 ° and top right at 45 ° -> the 2 ° in the middle at 90% and the 3 ° -> the 3rd at 75% at the bottom left to take the last part of the map The goal is when printing to win a page Feb 5, 2021 at 15:12
  • Can you create a grid and then shift it (using affine transformation) and delete those grid-cells that are empty? See here for something similar: gis.stackexchange.com/a/382480/88814
    – Babel
    Feb 5, 2021 at 15:23

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.