I'm using QGIS 2.18.4, I wanted to add "scale text" but can't find the tool for adding the scale text on the composer. I only see an option of add text and not "scale text" as in other GIS Software like ArcGIS. Is there anyone who knows this?

  • You dont know what you want. Who need scaled text? Try with font size. – nagib Mar 19 '17 at 13:16

If you want to add a numeric scale like 1:10000 you can add a normal scalebar first and then change the style to 'Numeric' under Item Properties > Main Properties of the scalebar element.

| improve this answer | |

You can register expression function to get your map scale. For example:

from qgis.utils import iface 

@qgsfunction(args='auto', group='Custom')
def get_composer_map_scale(comp_window_title, feature, parent):
    composer_views = iface.activeComposers()
    my_composition = None
    for view in composer_views:
        if view.window().windowTitle() == comp_window_title:
            my_composition = view.composition()
    if my_composition is not None:
        # adjust map id below if you have more maps in the composer
        comp_map = my_composition.getComposerMapById(0)
        scale = '{:.0f}'.format(round(comp_map.scale(), 0))
        return scale
        return 'Unknown'

And use it in your HTML box or label:

Scale 1:[%get_composer_map_scale( 'Composer 1' )%]

where 'Composer 1' is your composer title.

| improve this answer | |

In QGis 3.x you can add variables in text item with something like [%'1 : ' || round(map_get(item_variables('Main'), 'map_scale'),0)%]

| improve this answer | |

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.