Select to view content in your preferred language

A Complicated Labeling Challenge - Multiple Values Combined, Stacked and Non-Stacked.

1193
5
Jump to solution
05-16-2024 04:53 PM
JamiePiccin
New Contributor

Hello Everyone,

I have an established map label that I am trying to replicate:

NB_Clip.jpg

 

Notice how some polygon labels have only one number followed by a single modifier, while others have up to 3 numbers with up to three stacked modifiers.

It is a complicated label, but an established one from the Government. How would I replicate this in ArcMap Pro? My attribute table has all the values in separate columns.

Is anyone interested in the challenge? Keep in mind that I am not that 'programming' savvy and would prefer using the existing ESRI labeling tools. Any thoughts?

JDP

0 Kudos
2 Solutions

Accepted Solutions
DuncanHornby
MVP Notable Contributor

I can get some way to replicating what you see without any coding but labels may not be the final thing you want as labels are dynamic and move around as you zoom in/out. I suspect if you truly want what you see then you need to convert the labels to annotations and tweak as needed.

So this is my test data:

DuncanHornby_0-1715961201027.pngCreate two label classes, one called first the other called stacked.

DuncanHornby_1-1715961300479.png

For first set the label to be field firstval and set its font size to be big. Then set its positional properties

DuncanHornby_2-1715961419386.png

 

Now select your stacked label class and ensure the expression are the 3 fields SPACED separated as shown below.

DuncanHornby_3-1715961543041.png

Set your stacked position to fixed and offset.

DuncanHornby_4-1715961635675.png

Now set fitting strategy to be stacked splitting at space.

DuncanHornby_5-1715961734454.png

 

This gets you this:

DuncanHornby_6-1715961795955.png

 

It's close to what you desire but I believe you need to convert this to an annotation layer which you can then tweak.

Converted to annotations and played around with I now have this. Don't under estimate how much effort that is going to take if you have thousands of polygons to adjust!

DuncanHornby_7-1715962566234.png

 

View solution in original post

JesseWickizer
Esri Contributor

A composite callout could help you create this label style. It uses the PART text formatting tag to specify where to place content inside of a 9-part grid. 

In this case we'll put the primary letter in the middle part and the modifiers stacked inside the right part. We'll also use the FNT formatting tag to reduce the font size of the modifiers. Here's what the Arcade label expression looks like:

var modifiers = $feature.Modifier1;
if (!IsEmpty($feature.Modifier2)) {
  modifiers = modifiers + TextFormatting.NewLine + $feature.Modifier2;
}
if (!IsEmpty($feature.Modifier3)) {
  modifiers = modifiers + TextFormatting.NewLine + $feature.Modifier3;
}

return "<PART position='middle'>" + $feature.PrimaryCode + "</PART>" +
"<PART position='right'><FNT size='10'>" + 
modifiers + "</FNT></PART>";

The PART tag is only used with Composite callouts so next we'll edit the label Symbol properties.

1. In the Appearance section, set the Font size to something large like 24 pt.

2. Expand the Callout section and select Composite. This opens many different options to configure. In the map example you provided there isn't a background to the labels so change all the various callout property colors to No color and widths and margins to 0 pt

JesseWickizer_1-1724280872259.png

Here's what these labels look like in some sample data.

JesseWickizer_2-1724281660785.png

 

View solution in original post

5 Replies
DuncanHornby
MVP Notable Contributor

I can get some way to replicating what you see without any coding but labels may not be the final thing you want as labels are dynamic and move around as you zoom in/out. I suspect if you truly want what you see then you need to convert the labels to annotations and tweak as needed.

So this is my test data:

DuncanHornby_0-1715961201027.pngCreate two label classes, one called first the other called stacked.

DuncanHornby_1-1715961300479.png

For first set the label to be field firstval and set its font size to be big. Then set its positional properties

DuncanHornby_2-1715961419386.png

 

Now select your stacked label class and ensure the expression are the 3 fields SPACED separated as shown below.

DuncanHornby_3-1715961543041.png

Set your stacked position to fixed and offset.

DuncanHornby_4-1715961635675.png

Now set fitting strategy to be stacked splitting at space.

DuncanHornby_5-1715961734454.png

 

This gets you this:

DuncanHornby_6-1715961795955.png

 

It's close to what you desire but I believe you need to convert this to an annotation layer which you can then tweak.

Converted to annotations and played around with I now have this. Don't under estimate how much effort that is going to take if you have thousands of polygons to adjust!

DuncanHornby_7-1715962566234.png

 

JesseWickizer
Esri Contributor

A composite callout could help you create this label style. It uses the PART text formatting tag to specify where to place content inside of a 9-part grid. 

In this case we'll put the primary letter in the middle part and the modifiers stacked inside the right part. We'll also use the FNT formatting tag to reduce the font size of the modifiers. Here's what the Arcade label expression looks like:

var modifiers = $feature.Modifier1;
if (!IsEmpty($feature.Modifier2)) {
  modifiers = modifiers + TextFormatting.NewLine + $feature.Modifier2;
}
if (!IsEmpty($feature.Modifier3)) {
  modifiers = modifiers + TextFormatting.NewLine + $feature.Modifier3;
}

return "<PART position='middle'>" + $feature.PrimaryCode + "</PART>" +
"<PART position='right'><FNT size='10'>" + 
modifiers + "</FNT></PART>";

The PART tag is only used with Composite callouts so next we'll edit the label Symbol properties.

1. In the Appearance section, set the Font size to something large like 24 pt.

2. Expand the Callout section and select Composite. This opens many different options to configure. In the map example you provided there isn't a background to the labels so change all the various callout property colors to No color and widths and margins to 0 pt

JesseWickizer_1-1724280872259.png

Here's what these labels look like in some sample data.

JesseWickizer_2-1724281660785.png

 

JamiePiccin
New Contributor

Hello Jesse. THIS IS GREAT! I have never used, or seen, the <PART> function before. I have been using this all afternoon with my data and it is great. But I did come across one additional problem...

As seen in the original image there can be up to 3 'deciles' with up to 3 stacked modifiers for each. When I try to combine multiple stacked labels into one label they just stack on top of one another. Which kind of makes sense when using the <PART> function.

I am thinking that I might have to have 3 copies of the same shapefile, one for each decile using the <PART> label function. It will not put the labels together in a straight line, but at least they will be labelled.

Do you have any additional ideas?

Thanks again Jesse! This was a fun exercise to learn a new label function. 😀

0 Kudos
JesseWickizer
Esri Contributor

You wouldn't have to make duplicate copies of the shapefile - instead you could make 3 different label classes on the same layer - one for each of the 3 deciles. 

The composite callout is made up of a 3x3 grid so putting all the deciles side-by-side wouldn't work, though you could arrange them in other ways. There's an extra "floating" part that can be positioned outside the 3x3 parts grid that gives us some extra flexibility. 

3 Deciles Stacked

Label components would be arranged in the 3x3 composite callout grid like this:

Decile 1 (topleft)modifiers 1 (top) 
Decile 2 (left)modifiers 2 (middle) 
Decile 3 (bottomleft)modifiers 3 (bottom) 

 

2 Deciles side-by-side, 3rd Decile below

Expression for all Deciles in a single label, arranged as in the grid below:

 

var modifiersA = $feature.Modifier1;
if (!IsEmpty($feature.Modifier2)) {
  modifiersA = modifiersA + TextFormatting.NewLine + $feature.Modifier2;
}
if (!IsEmpty($feature.Modifier3)) {
  modifiersA = modifiersA + TextFormatting.NewLine + $feature.Modifier3;
}

var modifiersB = $feature.Modifier1b;
if (!IsEmpty($feature.Modifier2)) {
  modifiersB = modifiersB + TextFormatting.NewLine + $feature.Modifier2b;
}
if (!IsEmpty($feature.Modifier3b)) {
  modifiersB = modifiersB + TextFormatting.NewLine + $feature.Modifier3b;
}

var modifiersC = $feature.Modifier1c;
if (!IsEmpty($feature.Modifier2c)) {
  modifiersC = modifiersC + TextFormatting.NewLine + $feature.Modifier2c;
}
if (!IsEmpty($feature.Modifier3c)) {
  modifiersC = modifiersC + TextFormatting.NewLine + $feature.Modifier3;
}
return "<PART position='left'>" + $feature.PrimaryCode + "</PART>" +
"<PART position='middle'><FNT size='10'>" + 
modifiersA + "</FNT></PART>" +
"<PART position='right'>" + $feature.PrimaryCode2 + "</PART>" +
"<PART position='floating' x_offset='21' y_offset='29' v_align='bottom'><FNT size='10'>" + 
modifiersB + "</FNT></PART>" +
"<PART position='bottom' y_offset='-2'>" + $feature.PrimaryCode3 + "</PART>" +
"<PART position='bottomright' x_offset='4' y_offset='-2'><FNT size='10'>" + 
modifiersC + "</FNT></PART>";

 

    
Decile 1 (left)modifiers 1 (middle)Decile 2 (right)modifiers  2 (floating)
 Decile 3 (bottom)modifiers 3 (bottomright) 

JesseWickizer_0-1724427723527.png

2 Deciles side-by-side, 3rd Decile in a separate label class

Expression for Deciles 1 and 2 in a single label:

 

var modifiersB = $feature.Modifier1b;
if (!IsEmpty($feature.Modifier2)) {
  modifiersB = modifiersB + TextFormatting.NewLine + $feature.Modifier2b;
}
if (!IsEmpty($feature.Modifier3b)) {
  modifiersB = modifiersB + TextFormatting.NewLine + $feature.Modifier3b;
}

var modifiersC = $feature.Modifier1c;
if (!IsEmpty($feature.Modifier2c)) {
  modifiersC = modifiersC + TextFormatting.NewLine + $feature.Modifier2c;
}
if (!IsEmpty($feature.Modifier3c)) {
  modifiersC = modifiersC + TextFormatting.NewLine + $feature.Modifier3;
}
return "<PART position='left'>" + $feature.PrimaryCode2 + "</PART>" +
"<PART position='middle'><FNT size='10'>" + 
modifiersB + "</FNT></PART>" +
"<PART position='right'>" + $feature.PrimaryCode3 + "</PART>" +
"<PART position='floating' x_offset='21' v_align='bottom'><FNT size='10'>" + 
modifiersC + "</FNT></PART>";

 

JesseWickizer_1-1724427757885.png

0 Kudos
DuncanHornby
MVP Notable Contributor

I think Jesse's approach is a superior method in that you don't have to convert to annotations and tweak positioning which was a limitation in my approach. I've not deleted my answer because it's probably useful to see an alternative approach and both answers shows off the bewildering array of labelling options!

Nice one Jesse!

0 Kudos