Nice trick for centering text label above the existing feature

This short article will tell you how to place your text label exactly in the center of some existing features. The example is QGIS-based, although its usage is quite versatile as long as you create the text in the text box.
The image below shows the print layout in QGIS (Pic. 1) which includes the main map.

QGIS print layout sample map

Pic. 1 QGIS print layout sample map.

We want to have the map title placed at the top of this map, but just within the main map area. It must be centered, so how can we do that?
1. Whenever you create a textbox – stick its bounds to the edges of the existing feature (Pic. 2). This is almost all you need to worry about in this process.

QGIS print layout creating label text

Pic. 2 Creating label text in QGIS print layout where the text box corners stick roughly to the map bounds (1).

QGIS print layout text label customizing

Pic. 3 Changing text and customizing it in QGIS print layout.

2. When your text is ready for display (Pic. 3), just only one thing left to do. It’s setting our Horizontal Alignment to the Center (Pic. 4) and the job is done!

QGIS Print layout map text centering

Pic. 4 Final centering the text label in QGIS print layout.

The same way of doing it in Excel (Pic. 5).

Centering text on image Excel

Pic. 5 Centering text on image in Excel.

In other applications, we can do it pretty much on the same basis.

Mariusz Krukar



You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *