In the numeric scalebar in QGIS 3 is it possible to add a thousands seperator of ',' and also some text after the value?

enter image description here

This should be "1:500,000 at B0" for example.

I have tried Display and Font options but can't find anything to format the value as numerical with a thousands seperator or add a suffix text.


1 Answer 1


You may achieve what you want by using HTML-frame in the Layout.

In the Layout add a HTML-frame enter image description here, choose 'Source' as HTML-source and add a similar code like this

[%'Scale 1:'  || format_number(map_get(item_variables('atlas_map'), 'map_scale'),0) || ' at B0'%]

enter image description here

Change atlas_map to the name (id) of your map. enter image description here

If you need the comma as separator, this may be the solution (works on my computer set up for Norway):

'Scale 1:'  || regexp_replace(format_number(map_get(item_variables('atlas_map'), 'map_scale'),0),'\\D',',') || ' at B0'

enter image description here

Read more about regexp_replace: https://www.techonthenet.com/oracle/functions/regexp_replace.php

You may use additional HTML style- or CSS-code to change the appearance further.

  • Thanks -that didn't work for me but based on your idea I tried the following {'1:'+format_number((map_get(item_variables('Main'),'map_scale')),0)+' at B0'} and it works.
    – GeorgeC
    Aug 27, 2019 at 10:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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