Below you will find some materials presented at our 2022 User Conference ArcGIS Pro: Advanced Map Labeling technical workshop.
Proper case Arcade label expression:
Use the Proper() Arcade function to convert the first letter of each word to uppercase and the rest of the letters to lowercase. Below is the more complex expression we used for street labeling, preserving the directionals (NW, SW, etc) as uppercase and converting the numbered streets (12th, 21st, etc) to lowercase.
//split label into words
var words = split(upper($feature.ROUTENAME), " ")
//provide list of directions to be upper case
var upperWords = ["N", "NW", "W", "SW", "S", "SE", "E", "NE", "US"]
// provide list of ordinals to be lower case
var lowerWords = ["1ST", "2ND", "3RD", "4TH", "5TH", "6TH", "7TH", "8TH", "9TH", "0TH", "1TH", "2TH", "3TH" ]
var label = ""
// loop through words
for (var i in words)
{
var word = words[i]
/* determine whether they'll be upper or lower case if lower check the length is long enough and then
check the three right hand characters to ensure match lowerWords variable */
var isUpper = indexof(upperWords, word) > -1
var isLower = count(word) >= 3 && indexof(lowerWords, right(word, 3)) > -1
// reconstruct label
if (isUpper)
label += word + " "
else if (isLower)
label += lower(word) + " "
else
label += proper(word) + " "
}
// return it to the label engine
return label
Interstate Highway shield Arcade label expression:
This expression uses the Right() and Count() Arcade functions to extract the characters after the word "Interstate " in the STREETNAME field:
Right($feature.STREETNAME, Count($feature.STREETNAME) - 11)
Institute points alternate label expression:
This expression was used in our alternate expression of our abbreviation settings in our Institutes point layer.
- It creates arrays of uppercase words commonly found in education place names and a separate array of words found in religious institution names.
- 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.
- 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 Knowledge Base article 30494.
Additional Resources:
Help article: Label with the Maplex Label Engine
Quick-start Tutorial: Label your map