Label Placement

Line Feature Label Placement

This is a quick description of how Maperitive places labels on line features (streets, rivers etc.). The system is likely to change in the future.

Currently Maperitive tries to fit the text into the width of the street, but there are several rendering properties (see the Default rules as an example) which control this:

  1. Maperitive ignores any potential text placements which are too winding (= not straight enough). lflp.max-allowed-corner-angle property specifies the maximum angle (in degrees) that is allowed of any corner for such a label.
  2. By specifying lflp.min-buffer-space you set the minimum buffer (in pixels) between the street's end points and the text label.
  3. If this minimum cannot be reached, Maperitive tries to condense the font horizontally (but only up to lflp.max-compression value (1 means no compression, 0.5 means the text can be compressed up to 50%).

If none of this works, the label will not be displayed. You cannot directly force a particular label to display itself, but you can lower the quality criteria and thus make more labels visible.

Important thing to note is that you can set these settings both "globally" for the whole stylesheet and you can also override them in each target rule. So you can have different labeling quality settings for different features.

Currently Maperitive does not have a label collision detection (meaning it will not detect two or more overlapping labels). It also does not eliminate label duplicates (which means two or more labels with the same text could end up being displayed next to each other). These and other improvements (text abbreviations, more quality settings) are planned in the near future.

See also: