[GIS] Setting the scale text for a specific map inside a label

labelingprint-composerqgis

I am trying to archive the following:
I have a print setup with 3 map canvases. I want to set the scale text for a specific map canvas (lets say its ID is "main_view").

In QGIS 2.14. I can use the normal scale bar and set its style to "numeric" and link it to my desired map canvas. However I have dynamic text in which the scale text will be integrated like this:

<b>Further Infos:</b> <br>[%"open_info"%]
Created: [% day( now())%].[% month(  now() )%].[% year(  now() )%]
Scale: [%$scale%]

So I can not use the transformed version from the scale bar. The command [%$scale%] yields just a 0 because I dont know how to link to my map specific canvas.

Best Answer

In QGIS 3.0.3 I have insert the scale in a label text with the expression:

map_get(item_variables('**XXX**'), 'map_scale')

or rounded:

'1:'|| round(map_get(item_variables('**XXX**'), 'map_scale'),o)

Where **XXX** correspond to the Item ID of the map that You have to define before

Related Question