Hello Everyone,
I have an established map label that I am trying to replicate:
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
Solved! Go to Solution.
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:
Create two label classes, one called first the other called stacked.
For first set the label to be field firstval and set its font size to be big. Then set its positional properties
Now select your stacked label class and ensure the expression are the 3 fields SPACED separated as shown below.
Set your stacked position to fixed and offset.
Now set fitting strategy to be stacked splitting at space.
This gets you this:
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!
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.
Here's what these labels look like in some sample data.
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:
Create two label classes, one called first the other called stacked.
For first set the label to be field firstval and set its font size to be big. Then set its positional properties
Now select your stacked label class and ensure the expression are the 3 fields SPACED separated as shown below.
Set your stacked position to fixed and offset.
Now set fitting strategy to be stacked splitting at space.
This gets you this:
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!
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.
Here's what these labels look like in some sample data.
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. 😀
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) |
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>";
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!