I would like to know if is possible, maybe with some of the code, to avoid repeating labels of different elements of my layer if these have the same value.

I have attached this example:

enter image description here

These are two elements with the same value in the "nam" column. There are other examples which have 20 elements with the same value for example.

  • 4
    doea gis.stackexchange.com/questions/445590/… help?
    – Ian Turton
    Commented Oct 20, 2023 at 16:02
  • 2
    This looks like a roads layer. If so, when I had the same problem I dissolved the various pieces of the road together into a single feature which then gave me much better control over label placement. After all, these pieces are all part of a single logical road; the breakdown into multiple features is just an artifact of digitization or some other issue about representation that is unrelated to how I wanted to show it on my map.
    – Llaves
    Commented Oct 20, 2023 at 16:50
  • Hi @Llaves!. Yes, I had that idea and, for example, dissolve and then split the feature into a few elements to have more than one label. I thought some code could automate this situation. I'll try the option that @IanTurton gave. Commented Oct 24, 2023 at 13:39
  • 3
    I presume you have tried the in built 'Merge connected lines to avoid duplicate labels' option first?
    – she_weeds
    Commented Oct 24, 2023 at 15:41
  • Yes @she_weeds, exactly. But it doesn't seem to work at all well. Commented Oct 25, 2023 at 10:28


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.