Something a bit more Advanced: Using expressions for labelling

UPDATED: June 28, 2017

User-added image

Something a bit more Advanced: Using expressions for labelling

User-added imageLabels are one of the most useful elements of a map. The standard label functionality in MapInfo Pro allows users to label using one of the layer's columns, but layers can also be labelled using an expression. This allows users to make extra information visible on the map.

To use an expression for labelling, open the Layer Properties dialog by double clicking on the layer to be labelled. In the Label Display tab, click the Label with drop-down and list and select "Expression...". In MapInfo Pro version 12.0 and above, there is also a handy button next to the drop-down.

User-added image
Creating a label expression

With MapInfo Pro 16.0, and the earlier 64 bit versions, you can also access the Label Expression dialog via the Label Using control on the LABELS tab which appears when you select a layer in the Layers list.

User-added image
Label Expression from the LABELS tab

In the Expression dialog, the label format can be pieced together. Many different SQL and MapBasic functions can be used to create label information. Here are a few examples.

Concatenate values

The contents of two columns can be concatenated using the + symbol. In the example shown in figure below, the two column values are separated by a space between them. If one of the columns does not contain a value, that part of the label will remain empty. 

User-added image
Name and postcode - Australian Suburbs & Localities and Postcodes products

Carriage return and case functions

The code Chr$(13) can be used to insert a carriage return in the label expression, making the second part of the label appear under the first. In the example in figure below, the proper case function is also used to make the upper case contents of the NAME field appear in proper case. 

User-added image
Name and postcode with carriage return - Australian Suburbs & Localities and Postcodes products

Complex functions

Other MapBasic functions can be used, such as using the object area function to display areas (area(obj,"sq km"), or to combine area and population values to show a population density value (shown in figure below).

A performance tip: Keep in mind that using complicated functions may slow down your map draw time, as the values will be calculated on the fly each time a label displays. It may be preferable to create a new column and update it with the calculated value, then label using the new column instead.

User-added image
Population density of Mesh Blocks - ABS Census data 2011

Extra tip: Keep Now that you are able to add extra information to labels, beware creating too much clutter on the map - too much information is just as bad as not enough! You may wish to create multiple label overrides with more label information at low zooms and less information at high zooms.

To create multiple label overrides for the same layer, right click on the layer and select "Add a Label Override". Do this again to create two label overrides that can be styled separately and can use different labeling expressions.

User-added image

Data included in this article includes Suburbs & Localities Australia 2013.08, Postcodes Australia 2013.08 and the ABS Mesh Block data from the 2011 census. For information on MapInfo Data products visit our Web site at

User-added image
Article by Anika Claire, Data Engineer based in Brisbane, Australia.

When not writing articles for "The MapInfo Pro" journal, Anika enjoys making map data from around the world look nicer. Outside of work Anika loves to travel, although with a toddler and another bub on the way, this is becoming tricky. Instead, she likes to read many fantasy books and play computer games.



  • No Downloads