Skip to main content
1 of 2
Remi.M
  • 119
  • 6

Thank you for those first answers. As I have poor knowledge of coding, it'll take time before I meet a result.

My research led me to a plugin (Layout loader) , which is able when opening the composer to zoom directly to the canevas location. However for certain reasons, I am not likely to use that plugin, and so I'll carry on with your solutions.

Here is the link to the plugin : link to Github

And here, an extract of the code:

        # Get current canvas extent and apply that to all maps (items) in layout
    # Replace any text "{{title}}" in any layout label with the dialog Title text
    canvas = iface.mapCanvas()
    for item in l.items():
        if item.type()==65639: # Map
            item.zoomToExtent(canvas.extent())
        if item.type()==65641: # Label
            item.setText(item.text().replace('{{title}}',title_text))
Remi.M
  • 119
  • 6