3

My goal is the following: I would like to show every street name/label, without overlapping (the scale I use is <20000, and it is changing).

The default label is curved, 8p, but if the software can't show an label (because of the street is too short in the actual scale), then the size of label of that street changes to 7p, or to 6p, depend on what is possible to display (I think it depends on the length of the street on the actual scale). If it is not possible at all to a label in curve, then it is labelled in parallel mode.

Simply:

If it is possible to show, Font size = 8p, Curved label

Else if it is possible to show, Font size = 7p, Curved Label

Else if it is possible to show, Font size = 6p, Curved Label

Else Font size = 6p, Parallel Label

How is it possible in QGIS?

I tried to solve the problem by rule-base labelling, but it does not give a perfect solution, just approximately solution (because it depends on the font style, etc.)

8p, curved, rule:  $length  /@map_scale *1000>= (length( "Name" )*1.6)
7p, curved, rule:  ($length  /@map_scale *1000< (length(  "Name" )*1.6)) and ( $length  /@map_scale *1000>= (length(  "Name" )*1.3))
6p, curved, rule:  ($length  /@map_scale *1000< (length(  "Name" )*1.3)) and ( $length  /@map_scale *1000>= (length(  "Name" )*1.0))
6p, paralel, rule:  $length  /@map_scale *1000< (length(  "Name" )*1.0)

1 Answer 1

2

You can set the Font Size to be a factor of the length of the geometry to be labeled and a number, so you would set your SIZE to an expression that uses

length($geometry) * number

note my data is in decimal degrees, which doesn't lend itself to a good example, but it does show that it works! enter image description here

Then the labels display as:

enter image description here

3
  • This is a good option but it's hard to find the right scaling factor since font sizes are measured by height not width. A monospace font might make things more predictable.
    – user52245
    Commented Sep 15, 2016 at 6:52
  • Yes, with a monospace font it might be a good solution, but i don't like to use monospace font on my maps, because it causes longer labels. And I would like to use curve labeling, wherever it is possible. Commented Sep 15, 2016 at 7:52
  • 2
    @AaronPetri see the answer on this post - might lend a solution as well: gis.stackexchange.com/questions/212832/… Commented Oct 3, 2016 at 15:05

Not the answer you're looking for? Browse other questions tagged or ask your own question.