the following code automates the project CRS for display as text in my maps.
[% @project_crs %]
Can anyone provide me with something which will automate the scale of the map?
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It only takes a minute to sign up.
Sign up to join this communitythe following code automates the project CRS for display as text in my maps.
[% @project_crs %]
Can anyone provide me with something which will automate the scale of the map?
You need to access to the scale of your map that is in the same layout.
To do so there is a function called item_variable()
that could access to all the variables for any item in your layout.
Take the name of your map in your layout. In my case it is Carte 1
Then add a text box with the expression below to get the format you prefer. Don't forget to change the text Carte 1
to the name of your map.
To get a format like "18836.438"
[%map_get( item_variables( 'Carte 1' ), 'map_scale' )%]
to get a "rounded" value like "19000"
[%round(map_get( item_variables( 'Carte 1' ), 'map_scale' ), -3)%]
to get a value like "1 : 18 836"
'1 : ' || format_number(map_get( item_variables( 'Carte 1' ), 'map_scale' ),0)