I have three maps (data frames) in my QGIS composer and would like to link the size, rotation and extents of the maps so that when I 'move item content' or change the rotation in one of the maps it will change in the other maps.

Is there a way to do this?


It sounds like you could achieve this result by using overviews. One map effectuively becomes the 'master' in this scenario. Select one of the 'slave' maps and scroll down through the map composer options (on the left of a standard screen) until you see 'Overviews'. Click the green plus and in the "Draw overview" section set 'Map Frame' to be the Master from the drop down. Check the box 'center on overview'. If you don't want the highlighting you can now un-check the 'Draw overview' option (but you nee to check this initially to link the maps) or alternatively you could change the style of the overview frame. Then reapt the procedure for your second 'slave' map. Now when you pan one map the others move also. You can set the scale opf each map separately.

The only limitation on this is that it does not also match rotation if you turn the Master map. To achieve that, you would need to use variables. The simplest way would be to set a Project variable (just don't call it 'map_rotation' as that's a reserved name already and won't be recognised). Then use that variable to change all the map rotations simultaneously (rather than mannually in map composer. I may be wrong but I don't think there is currently a way to read a composer element variable directly without writing a script.

  • 3
    In QGIS 3 you can access a list of each map elements variables by its ID with item_variables('ID') and the value of a distinct variable (i.e. map scale) by map_get(item_variables('ID'), 'map_scale'). Assume you access map0's map scale this way you can use data defined override to set map1's map scale. – Jochen Schwarze Oct 4 '18 at 7:53
  • Excellent! That's a great update on QGIS 2.x – MappaGnosis Oct 4 '18 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.