Flat label placement in cartographic rendering
• • •
Map totems levélo @Marseille
Flat label placement?
Concretely, how does it work?
In the various cartographic rendering software packages, one of the most difficult issues to solve is label placement.
Placement information does not exist in GIS databases. The label is information associated with a point, a curve or an area, and its placement is an operation to be performed after configuring the rendering of all the features of the final drawing.
Relevance and legibility are the watchwords.
LorikGISMapper offers the most efficient tool on the market to place both curved labels on curves, such as street or river names, and so‑called flat labels, for example city or building names.
The algorithm and its interface were designed to answer the questions a cartographer asks and have evolved extensively following customer feedback from some of the most diverse and representative organizations in the mapping world.
Here we will focus on flat label placement.
It relies on the LorikSoftware suite which provides a complete symbology intended for cartography, and a set of original geomatics processing and label‑placement algorithms.
How to write it?
Take a simple label with a specified font and size. It can, depending on the user’s choice, be modified in several ways:
- Use a different font
- Abbreviated, via the use of an abbreviation dictionary
- Placed on multiple lines
- Be reduced in size
- Be replaced by another text (information provided beforehand when importing the label)
- Any possible combination of these modifications
What is its footprint?
The first thing to know is the label’s footprint.
The processing will consider the label’s bounding polygon.
Where to place it?
The most obvious answer is: centered on the point… but maybe not. And if we cannot place it at that location, where then? To allow defining this choice we identify 9 zones around the point as shown on this diagram (right):
The label is centered if it covers the point. It is top if it intersects the upper vertical segment, and similarly bottom, right and left. There remain 4 zones, namely top‑left, top‑right, bottom‑left and bottom‑right.
We define a maximum distance to the point (in blue on the diagram) and optionally a minimum distance allowing to move away from the point if needed:
It is also possible to split the space into concentric zones for greater flexibility in placement:
Where not to place it?
By nature the label will be placed so as not to cover another label, including a label on curve such as street names.
We also define a minimum distance between the label and entities to avoid:
It can also avoid, at the user’s choice, symbols, curves or areas depending on their symbology. For example, it avoids roads but may be placed on some buildings.
Without avoiding roads:
Avoiding roads:
How to choose?
At placement time, the algorithm must place the label as close as possible to its point while avoiding a whole set of entities and choosing a space zone and possibly a modification.
It will test all possibilities but one may prefer to place it further away without modifying it, or for example place it to the right even if that requires reducing its size.
Choice of the space zone:
We give an order to the space zones, also having the possibility to forbid some. For example first center then right and never left…
On the following diagram we note the order by a priority number:
Choice of the modification:
In the same way, we give an order to possible modifications, having the ability this time to forbid or force certain ones.
The algorithm will attempt to place without modification, then with all possible combinations of the above modifications.
For example we have the original label, then abbreviated, on two lines, abbreviated and on two lines, reduced, reduced and abbreviated, reduced and on two lines … which gives:
The algorithm can now order its choices. It will attempt to place the label without modification in all zones of the first concentric circle. Then it repeats with the first modification, then the second and so on. And finally it repeats with the zones of the next concentric circles.
Final choice?
Several options are possible: take the first solution found, minimize modifications or choose the solution closest to the point.
Take the example of a placement that searches in order to place the label centered, then left, then right and so on with a certain number of obstacles:
First solution found
Center and left impossible, right with modification
Closest
Requires a reduced placement on two lines
Fewest modifications
In the second concentric circle
How to place the most important labels in the best way?
Each label text type has its placement options and its priority.
In the following example, we have different symbology for large cities, medium cities and small towns, each with a different minimum distance to obstacles:
We give a higher placement priority to large cities which will therefore be placed first, lower to medium, then small, yielding:
Flat labels first or labels on curves first?
On this question, LorikGISMapper offers the choice. You can place flat labels before labels on curves for some, and the opposite for others.
The influence is significant, as this example shows.
Placement before:
The label Musée de l’Oeuvre Notre‑Dame is large and forces the label on curve Rue des Cordiers to be on two lines.
Placement after:
The label Musée de l’Oeuvre Notre‑Dame is small, Rue des Cordiers is on a single line, Pas. Hans Haug appears, which was impossible in the previous case, but the flat label Cabinet des Estampes et des Dessins could not be placed.
What to do in case of impossibility?
If a label cannot be placed in any way, the software offers to try several times to re‑place it while each time avoiding a reduced list of entities.
In the following example where the label must avoid minor roads for better legibility, it is acceptable that in case of impossibility, the label may still be overlaid on such a road:
If finally placement is definitively impossible, the label can be retrieved and placed in a dedicated layer of the software, so that the user can identify and delete or modify it with the full editing power of the LorikSoftware suite.