Additional Remove Duplicate Labels Option

632
1
01-27-2023 09:06 AM
Status: Open
Labels (1)
Laurenventure
Occasional Contributor

Building rather complex labeling expressions for labeling street block ranges can be very challenging. I think it would be cool if there was an option to remove duplicate based on an attribute. If one has various fields with the same attribute (in this example '0') then one could easily remove that duplicated label across everything.roadlabel.PNG

1 Comment
JesseWickizer

Depending on your preference, there are a few ways to remove duplicate address number labels. Each of these suggestions uses the Street address placement label placement style. In the examples below, note the address placements along S KENOSHA DR, which has some duplicate (0) placements along one side of certain segments. Orange arrows indicate line direction. Red labels are from/low address ranges and blue labels are to/high address ranges.

Method 1: Only display duplicate value in the "to" address label

If the segment has the same address range for the from/low and to/high, use an arcade expression to only show the duplicated address range value once - in the to/high position. 

Default placementRemoving duplicate values along same side
JesseWickizer_2-1675096515206.png

 

JesseWickizer_1-1675096495139.png

 

The label expression for the From addresses uses this arcade expression:

 

var l_from = $feature.l_lo_addr;
if ($feature.l_lo_addr == $feature.l_hi_addr) {
  l_from = "";
}
var r_from = $feature.r_lo_addr;
if ($feature.r_lo_addr == $feature.r_hi_addr) {
  r_from = "";
}

return l_from + TextFormatting.NewLine + r_from

 

The label expression for the To addresses uses the usual arcade expression for street address labeling:

 

$feature.l_hi_addr + TextFormatting.NewLine + $feature.r_hi_addr

 

Method 2: Don't display "0" values

Use Arcade expressions in the label classes to suppress "0" values. Similar to the above, but just suppressing all address range values of zero.

Default placementRemoving all zero values
JesseWickizer_3-1675096794258.png

 

JesseWickizer_4-1675096806134.png

 

The label expression for the From addresses:

 

var l_from = $feature.l_lo_addr;
if (l_from == 0) {
  l_from = "";
}
var r_from = $feature.r_lo_addr;
if (r_from == 0) {
  r_from = "";
}

return l_from + TextFormatting.NewLine + r_from

 

The label expression for the To addresses:

 

var l_to = $feature.l_hi_addr;
if (l_to == 0) {
  l_to = "";
}
var r_to = $feature.r_hi_addr;
if (r_to == 0) {
  r_to = "";
}

return l_to + TextFormatting.NewLine + r_to