1

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.

Taras
  • 32,823
  • 4
  • 66
  • 137
ANDRÉS
  • 91
  • 8
  • 4
    doea https://gis.stackexchange.com/questions/445590/show-single-label-for-features-grouped-by-identical-attributes-in-qgis help? – Ian Turton Oct 20 '23 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 Oct 20 '23 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. – ANDRÉS Oct 24 '23 at 13:39
  • 3
    I presume you have tried the in built 'Merge connected lines to avoid duplicate labels' option first? – she_weeds Oct 24 '23 at 15:41
  • Yes @she_weeds, exactly. But it doesn't seem to work at all well. – ANDRÉS Oct 25 '23 at 10:28
  • You don't have to split the dissolved lines to get multiple labels. Go to Properties->Labels->Placement and look for the repeating labels checkbox – Llaves Oct 25 '23 at 14:11

0 Answers0