Feature request #3843

Rule based labeling

Added by Nathan Woodrow almost 6 years ago. Updated over 1 year ago.

Status:Closed Start Date:
Priority:High Due date:
Assigned to:- % Done:

0%

Category:Labelling
Target version:Future Release - High Priority
Platform: Resolution:fixed/implemented
Platform version: Pull Request or Patch supplied:No
Status info:0 Tag:

Description

I think it would be a cool idea to have rule based labeling, something like we already have for the styling.

I had a case today that it would be good to label the main trunk lines (anything diameter > 350mm) of a stormwater network in red and bold and anything less in light gray so it's less distracting but it's still visible.

The lines were already styled using the rules to show a different scale but having rules on the labels would be very handy.


Related issues

related to QGIS Application - Feature request #8925: Saving label information/styles into an SLD File Open 10/21/2013
duplicated by QGIS Application - Feature request #5056: Allow labeling based on query Closed 02/19/2012
duplicated by QGIS Application - Feature request #4840: New feature: Being able to have more than one labeling fe... Closed 01/19/2012

History

Updated by Andrew Chapman over 5 years ago

I also regularly miss this feature. In the UK, the Ordnance Survey text layers have attributes that could potentially be used - currently one can only use them to select & save sub-sets of a layer then style as a new layer. One text layer can easily expand to 20... and with possibly 20 tiles, layer count and management starts to get out of hand.

Updated by Giovanni Manghi over 5 years ago

  • Assigned to deleted (nobody -)
  • Priority changed from Low to High
  • Target version deleted (Version 1.7.0)
  • Must fix deleted (No)
  • Platform deleted (All)
  • Pull Request or Patch supplied set to No

I agree that this is a important missing feature... now we have the rule based renderer is not hard to imagine how powerful the combo would be.

See also #3796

Updated by Sandro Santilli over 5 years ago

The cherry-on-cake would then be associating "rules" to "legend items" so that you can toggle visibility of single classes (both for features and labels).
Having that would completely replace my current hack described in issue #3796 for having multiple, optionally visible, labels per layer.

Updated by Sandro Santilli over 5 years ago

Also, in order for this to be satisfying for the need expressed in #3796, every label "class" will need to be configurable as a single label currently is (scale based visibility, placement, style etc.)

Updated by Giovanni Manghi over 5 years ago

  • Target version set to Version 1.7.4

Updated by Sandro Santilli about 5 years ago

  • Target version changed from Version 1.7.4 to Version 1.8.0

Surely not for 1.7, not sure if 1.8 is a good target or features should all be moved to 2.0 directly

Updated by Giovanni Manghi almost 5 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

Updated by Paolo Cavallini almost 5 years ago

  • Category changed from Map Canvas to Labelling

Updated by Regis Haubourg about 4 years ago

Should we move it to 2.1?

Updated by Paolo Cavallini almost 4 years ago

  • Target version changed from Version 2.0.0 to Future Release - High Priority

Updated by Christopher Wesson almost 3 years ago

Another example: styling a road number as a 'shield' and road name as text both off the same line feature... same request as above, i.e. the ability to label one layer or feature more than once.

Updated by Gavin Fleming over 2 years ago

another use case: labelling property boundaries with bearing above the line and distance below the line. At the moment the layer has to be brought in twice to do this.

Updated by Schalk Grobbelaar about 2 years ago

Gavin Fleming wrote:

another use case: labelling property boundaries with bearing above the line and distance below the line. At the moment the layer has to be brought in twice to do this.

Agree Gavin. This issue was opened 4 years ago and up to today it is still missing. I use this a lot and that is the thing that I talked about in that meeting with you and Tim where QGIS is lacking a lot of powerful SLD functions. In my use case: I, for example have different Rules based on different scales. Lets say I have a Layer (Provinces) that contains 2 fields (abbr and prov_name). I start of by showing the abbreviation field (abbr) as the label (Rule 1) and as the user zooms in he/she sees the prov_name (Rule 2) on another scale. This cannot be done in QGIS, only in Geoserver by editing the XML by hand (which takes a lot of time). The only thing missing here is to have an interface where you can also set label settings per rule which creates the <se:TextSymbolizer> under <se:Rule>.

I will really appreciate it if someone can come up with a solution for this.

Updated by Paolo Cavallini about 2 years ago

Please consider sponsoring a fix for this, if it is really important for you. Please ask if you are interested, and need advice.

Updated by Andreas Neumann almost 2 years ago

I agree with Paolo.

Someone who really needs this should step up and sponsor this feature or it won't be solved for another five years.

Introducing labeling rules is not a small feature that can be implemented in one evening. It requires several days of work. If no one pays for it or implements it by himself, it won't happen.

The majority of the recent new features in the past releases were paid development.

You can expect smaller issues to be solved by someone in his leisure time, but not bigger ones.

Updated by Nyall Dawson over 1 year ago

  • Status changed from Open to Closed
  • Resolution set to fixed/implemented

Implemented in 2.12

Also available in: Atom