How do you create multiple polygons from a QGIS Print Composer or Print Layout map extent (i.e. a polygon that are the exact area shown in a map within a print composer/layout)?

Ultimately I would like to do this for an entire atlas so I would like to do this in as automatic a way as possible, but I would even just be content with a rather manual solution too!

  • 1
    Do you think you could create the polygons first, then use them to drive the atlas pages? Commented Aug 21, 2018 at 16:32
  • Hmmm, perhaps, but I would probably have to ask another question as to how to do that (hehe), given I need the atlas pages to be all at the same scale, though within a fixed map area size, as well as say the map centre determined by a collection of shapes from the file that creates the atlas in the first place. Also, setting and keeping the same scale is an important part of the project and selecting it, testing with the atlas generation in the Print Layout window, was a relatively simple way of finding the best scale.
    – guestagain
    Commented Aug 22, 2018 at 1:04

2 Answers 2


A manual solution would be:

In print composer item properties > extents, find the xmin, xmax, ymin and ymax values of the map item.

Use the Geometry by expression tool to create a rectangular polygon. Substitute the actual values into this expression:

make_polygon( geom_from_wkt( 
  'Polygon(( xmax ymax, xmax ymin, xmin ymin, xmin ymax, xmax ymax ))' 
  • Thanks, yeah, just gone through and followed a similar process to this using a batch process with the "Create layer from extent" processing algorithm. Took a while but got the job done. I'll upvote the answer but leave the question unanswered in case we be so lucky as to find an automated or less manual solution.
    – guestagain
    Commented Aug 22, 2018 at 1:07
  • The automated method would be coding this in Python. See the Pyqgis cookbook if you want to attempt that.
    – csk
    Commented Aug 22, 2018 at 19:18

There is a way to create an automatic series of polygons that represent the Overview of your Atlas pages using the Field Calculator and the Geometry Generator.

In your Atlas Coverage Layer open the Geometry Generator and use the following expression to create a Polygon/Multipolygon geometry type

--Change variables according to your map

--layout map scale
with_variable('print_scale', 120000, (
--layout map height
with_variable('H_map', 190, (
--layout map width
with_variable('W_map', 277, (

with_variable('ex', (centroid(bounds($geometry))), (
with_variable('H_coverage', ((@H_map*0.0005)*@print_scale), (
with_variable('W_coverage', ((@W_map*0.0005)*@print_scale), (
geom_from_wkt( 'POLYGON(('|| 
(x( @ex) + @W_coverage)||' '||(y(@ex) + @H_coverage)||','||
(x( @ex) + @W_coverage)||' '||(y(@ex) - @H_coverage)||','||
(x( @ex) - @W_coverage)||' '||(y(@ex) - @H_coverage)||','||
(x( @ex) - @W_coverage)||' '||(y(@ex) + @H_coverage)||','||
(x( @ex) + @W_coverage)||' '||(y(@ex) + @H_coverage)||'))')))))))))))))

Considering an Atlas with fixed scale and fixed size of the map, just changing the variables print_scale, H_map and W_map according to your map layout, you will create polygons that cover exactly the printing area in each page of your atlas.

enter image description here

Using the same expression in the algorithm Vector Geoemtry->Geometry by expression, you can create a new layer with the Overviews of your Atlas.

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.