|
This script will label the SGID.U024.USGS24KQuads feature class with the SGID quad number, US quad name, and quad's Ohio code. For use in the ArcMap Label Expression at scales around 1:400000 or so.
Function FindLabel ( [NAME], [OHIO_CODE], [LOCATION]) tempName = [NAME] 'replace up to two spaces with line breaks where needed If (Len(tempName) > 6 And InStr(3, tempName, " ") > 0) Then tempName = Replace(tempName, Left(tempName, InStr(3, tempName, " ")), _ Left(tempName, InStr(3, tempName, " ") - 1) & vbNewLine) If (Len(tempName) > 15 And InStrRev(tempName, " ", Len(tempName) - 3) > 0) Then tempName = Replace(tempName, Mid(tempName, InStrRev(tempName, " ", _ Len(tempName) - 3)), vbNewLine & Mid(tempName, InStrRev(tempName, " ", Len(tempName) - 3) + 1)) End If End If 'form label string with formatting tags locstr = "<clr red='153' green='0' blue='0'>" & [LOCATION] & "</clr>" tempLabel = locstr & vbnewline & "<clr red='0' green='0' blue='0'>" & tempName & "</clr>" tempLabel = tempLabel & vbnewline & "<clr red='0' green='153' blue='0'>" & [OHIO_CODE] & "</clr>" FindLabel = tempLabel End Function |