QGIS Print Composer – How to Define and Alter Map Extent in QGIS Print Layout

print-composerqgis

How can I change the extent of a map in print layout to be a custom-sized region. I would like to be able to drag the handles of of the bounding box to resize them so that they touch the purple box. Currently dragging the handles makes the map rescale to be smaller but the doesn't "crop" the box.

Alternatively, is it possible to use a map layer to define the extent of the map? The purple areas is a vector layer that I would like to use to "crop" the map area by.

map with white space to be cropped out

On QGis version 3.28.2-Firenze

Edit: I was able to get achieve something close to the behaviour I wanted by checking "Lock layers". Item Properties>Layers>Lock layers, and then dragging to the bounding box handles. See this answer

Best Answer

  1. Determine the map size and aspect rato of your purpule box. Use the same aspect ratio in Width and Height parameter.

set size of a map

  1. Configure a map atlas with your purple layer as Coverage layer
  2. Tick Item Properties -> Controlled by Atlas and set Margin around feature to 0 %.

enter image description here

Alternatively, you could also use your yellow layer and set margin at some percent - eg. 10 %. This way the aspect ratio of a map is not that important as you will have white space around feature anyway.