This question already has an answer here:

I'd like to label points in a vector layer. In my attribute table I have a .csv with a list of material for each position (it's the planning of marathon race). Some of the cells are empty, though there is no need for a road barrier ("Gitter") or a fireman ("Feuerwehr") in every position.

If I insert too many labels (ID + others), they aren't visible anymore in the map.

Do you know what could be the problem?

Is it because empty cells do not work?

enter image description here

marked as duplicate by underdark Jun 4 '15 at 15:13

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • What's not visible anymore? The points or the labels? Also, the labels ignore empty cells so that shouldn't be a problem :) – Joseph Jun 3 '15 at 13:27
  • @Joseph: The labels in the map – kevkev Jun 3 '15 at 13:31
  • Have you tried checking the option in Layer Properties > Labels > Rendering > Show all labels for this layer? Also make sure the Limit number of features to be labeled to is unchecked. – Joseph Jun 3 '15 at 13:36
  • @Joseph yes, this correct - "Show all labels" is checked and "limit number..." is unchecked. But still, only those labels with values not equal NULL are shown in the map. (If I'd like to label "Gitter" and "Banden links", only the Point ID 2 has a label in the map) – kevkev Jun 4 '15 at 7:52

NULL in the attribute table means no data. So, there is nothing to write. You can use the expression dialog in the labeling options. Layer Properties > Labels > Label this layer with: Expression dialog (click the button)

enter image description here

If the value in the attribute field "wert" (or "Feuerwehr") is NULL , then QGIS will label the object with 'no data' (or 'NULL', 'Kein Wert', ...). And if the value is not NULL, QGIS will write the value.

I hope it will work for you!


The short version of Hanne K's CASE statement is

 coalesce("wert",'no data')

which returns the first non-null value, i.e. either the value in the "wert" column or 'no data' if "wert" is NULL.

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