Select to view content in your preferred language

ArcGIS Pro: Advanced Map Labeling - UC 2023 Workshop Resources

927
1
06-29-2023 01:41 PM

ArcGIS Pro: Advanced Map Labeling - UC 2023 Workshop Resources

Below you will find some materials presented at our 2023 User Conference ArcGIS Pro: Advanced Map Labeling technical workshop.

Institute points alternate label expression:

This expression was used as an alternate expression of our abbreviation settings in our Institutes point layer.

  1. It creates arrays of uppercase words commonly found in education place names and a separate array of words found in religious institution names.
  2. Then it loops through all the terms in each array, and if the term is found in the Name2 field value, it returns "Edu." or "Rel." to use as the entire label, depending on which array it is searching. Since the Find() Arcade function is case-sensitive, it converts the Name2 field value to uppercase for the comparison.
  3. Finally, if it is not found, it returns the feature's Name2 field value, converted to Proper case.

 

 

 

 

var eduSearchTerms = ["SCHOOL", "ACADEMY", "COLLEGIATE", "COLLEGE", "UNIVERSITY"]
var relSearchTerms = ["CHURCH", "MOSQUE", "SYNAGOGUE", "MONASTRY", "TEMPLE", "TABERNACLE", "WORSHIP"]

for (var i in eduSearchTerms)
{
  if(find(eduSearchTerms[i], upper($feature.Name2)) > -1)
    return "Edu."
}

for (var i in relSearchTerms)
{
  if(find(relSearchTerms[i], upper($feature.Name2)) > -1)
    return "Rel."
}

return proper($feature.Name2)

 

 

 

 

 

Abbreviation dictionary for official United States Postal Service abbreviations:

See Esri technical support article.

 

Advanced Label Expressions

These expressions use Upper()Right() and Count() Arcade functions to extract the characters after "Co Rd " or "State Hwy " in the FULLNAME field:

County Roads:

 

 

 

 

Upper(Right($feature.FULLNAME, Count($feature.FULLNAME) - 6))

 

 

 

 

State Highways:

 

 

 

 

Right($feature.FULLNAME, Count($feature.FULLNAME) - 10)

 

 

 

 

US Highways:

This expression takes into account any US Highways with banners in their names and places the banner above the number with a smaller font size.

Examples include "US Hwy 45 Alt" and "US Hwy 151 Bus"

JesseWickizer_2-1689046922604.png  JesseWickizer_3-1689046945045.png JesseWickizer_4-1689046957115.png

In general terms, here is what the script does:

  1. Extract all the text after "US Hwy " and assign it to the shieldValue variable.
  2. Check if there's a space in the remaining text which means it has a banner - if so, split by the space and assign the text on either side of the space to either the shieldBanner or shieldNumber.
  3. The shields with a shieldBanner use text formatting tags to reduce the leading between banner and text, and make the banner text a smaller font size (8pt).
  4. If there's no banner, don't do any special formatting - just return the number to be placed in the shield.

 

 

 

 

var shieldValue = Right($feature.FULLNAME, Count($feature.FULLNAME) - 7);
var shieldBanner = "";
var shieldNumber = shieldValue;
if(Find(" ", shieldNumber) > 0) {
  shieldBanner = Split(shieldNumber, " ")[1];
  shieldNumber = Split(shieldNumber, " ")[0];
  return "<LIN leading='-4' leading_type = 'extra'>" + "<FNT size='8'>" + Upper(shieldBanner) + 
         "</FNT>" + TextFormatting.NewLine + shieldNumber + "</LIN>";
} else {
  return shieldNumber; 
}

 

 

 

 

Text Formatting Tags

Superscript 2 in the Km squared label:

JesseWickizer_0-1689046873834.png

 

 

 

 

$feature.ALAND_KM2 + " km<SUP>2</SUP>"

 

 

 

 

State labels with average commute times and change in average commute time since 2010:

JesseWickizer_1-1689046882862.png

 

 

 

 

var arrowStyle = "▲"; //Default all arrows to show an increase
if($feature.CommuteChange2010_2021 < 0) {
  //Change to decrease arrow if the change in commute time decreased from 2010 to 2021.
  arrowStyle = "▼";
}
//Configure values for the CLR (color) tag based on the size of increase or decrease in commute time.
var arrowColor = "red='253' green='174' blue='97'"; // small increase
if($feature.CommuteChange2010_2021 > 1) {
  arrowColor = "red='215' green='25' blue='28'"; // large increase
}
if($feature.CommuteChange2010_2021 < 0) {
  arrowColor = "red='171' green='217' blue='233'"; // small decrease
}
if($feature.CommuteChange2010_2021 < -1) {
  arrowColor = "red='44' green='123' blue='182'"; // large decrease
}

//Use text formatting tags to:
// 1. Define the PARTs used in the Composite callout symbol grid.
// 2. Adjust font size of the state label with FNT tag.
// 3. Format numeric attributes using the Text function with a string pattern.
// 4. Set the arrow's color by inserting the parameters of the CLR tag set in the arrowColor above.
// 5. Put the commute time change value in italics with the ITA tag. 
"<PART position='middle'>" + 
"<FNT size='16'>" + $feature.STUSPS + "</FNT></PART>" +
"<PART position='right'>" + 
Text($feature.MeanCommute2021, "#.#") + " min" + TextFormatting.NewLine + 
"<CLR " + arrowColor + ">" + arrowStyle + "</CLR>" + 
"<ITA>" + Text($feature.CommuteChange2010_2021, "#.#") + " min" + "</ITA></PART>"

 

 

 

 

 

Additional Resources:

Help article: Label with the Maplex Label Engine

Quick-start Tutorial: Label your map

Abbreviation Dictionary for commonly used street suffixes: Technical support article

Comments
AyanPalit
Esri Regular Contributor

Excellent resources - added industry tags for ease of access. 

Version history
Last update:
‎08-25-2023 12:25 PM
Updated by:
Contributors