QGIS – Move Inset Map Based on Defined Anchor Point

atlasprint-composerqgis

In an Atlas the content of some maps are best suited for the inset to be on the Left bottom, on others it's the Right bottom of the map. If we add the xy of this point to the table that is used to generate the atlas, is it possible to use a data override to set the position of an anchor point?

For example

a. Inset Map on Bottom Left – good position as it doesn't cover any important features
enter image description here

b. Inset map covers important features and should be anchored on the Bottom Right
enter image description here

Can this be set in an override? The only other alternative I can think of is to create a second layout to use for pages when it should be on the right and to use a filter to print the pages separately.

I found a possible solution in ArcMap but I want to do this in QGIS 3.2

Best Answer

I had this problem before. The only way I found to do it was to write a IF expression for the inlay map's X position (item properties > position and size > X).

Make a note of the inlay map's X value in it's current position in the bottom left (going to call this x1), then drag it into the bottom right and note the new X position (calling this x2).

Now, imagine you have five pages in your atlas and the pages are named 1 to 5, you want the inlay at the bottom left for pages 1, 2, and 5, and at the bottom right for pages 3 and 4.

Write something like the following expression for the X value: IF(@atlas_pagename IN(1,2,5), x1, x2)

If the case arises where you need to also change the vertical position for some pages then you can just use the same process for the Y value.

Related Question