3

When I have vector layer with several objects and label them, can I change the text of individual labels? I have tried the labeling tools and the tool change label but the field with the label text is grayed out.

Is it possible to change individual label texts?

8
  • aren't you in read-only mode ?
    – Snaileater
    Nov 7 '19 at 14:06
  • Maybe... is there also a write mode I can activate? Couldn't find it so far. But if the field is grayed out I should be able to ungray it again right?
    – DGIS
    Nov 7 '19 at 14:12
  • 3
    You need to be in edit mode as you are trying to edit field value...(be careful as you will not only change the label text but also the value in the attribute table...)
    – J.R
    Nov 7 '19 at 15:04
  • @JR changing the labels without changing the content of the attribute table is the purpose of the labeling tool, i hope ... (since the data are stored in an auxiliary storage) ... There's maybe a way to locate this auxiliary storage on a ressource on which you have write acces ... that would be convenient ...
    – Snaileater
    Nov 7 '19 at 15:51
  • 1
    @snaileater You have write access to the auxiliary storage but the field you use to label is not in the auxiliary storage (it hold only placement setting field, no copy of the label field). As you could add field to the auxiliary storage one solution could be to create an "alt_label" field then filling it with the label text and setting it as label field but I can't find a way to make it work
    – J.R
    Nov 7 '19 at 17:40
5

GIS software isn't really designed for adding custom text annotations that have no connection to the source data attributes.

If you wanted to have totally custom labels for each feature that should be stored in a separate field in your layer (e.g. alt_label as J.R. suggested in the comments).

However some of these other options might help accomplish similar outcomes in some situations:

Label text substitutes You can find this under Labels > Text tab in QGIS 3.x up to 3.8, Labels > Formatting in Q 3.10 onwards. You can import and export lists of substitutions as well to use in various projects.

enter image description here

Using expressions in your text label value Instead of just using a field for your label you can use an expression and add custom rules to add/replace text for a specific feature or class of features as you see fit. Such as

case when "id" < 20000 then 'Not important' else to_string("id")||' (Important!) end

Or

case when "id" = 34565 then 'Special Thing' else "name" end

and so on.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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