2

I do not see any obvious setting for stacking labels in ArcMap (ArcView license).

Am I missing something or do i have to write a complex expression to stack my labels?

  • 1
    Can you tell us what data your field contains & how you want to stack it? – Devdatta Tengshe Sep 21 '10 at 17:44
  • 2
    New in Version 10.1: The Maplex for ArcGIS extension functionality has been moved into the core ArcGIS for Desktop product and is referred to as the Maplex Label Engine. – Jens Mar 7 '13 at 7:59
5

You can write an expression, but its not complex. Just type in "vbnewline" between the fields you want to label on, and it will create a stacked label.

[FIELD1] & vbnewline & [FIELD2]
  • Thanks. My labels are contained within 1 field so vbnewline will not work. – Jakub Sisak GeoGraphics Sep 21 '10 at 17:17
  • 1
    @Jakup- split the field value then "stack" your label using vbnewline (or vbcrlf)? – Derek Swingley Sep 21 '10 at 17:25
3

This works:

 Function FindLabel([Name]) 
  var = [Name]
  result = ""   
  splitStr = Split(var, chr(32))
  for i = 0 to UBound(splitStr)
     tmpStr = Trim(splitStr(i))
      if len(tmpStr) > 0 then 
         if result = "" then
         result = tmpStr 
     else
        result = result & vbnewline & tmpstr    
     end if
      end if
  splitStr(i) = tmpStr
  next
  FindLabel = result
End Function
0

Here is an alternative text wrapping using python:

import textwrap
def FindLabel ( [Name] ):
  return textwrap.fill([Name],20)

Although it is probably better to use Maplex if you can.

0

I was getting an Error 'Invalid use of Split:Null', so I added an additional Null check before Split function, Now the new code looks like:

  Function FindLabel ( [Name] )
     var = [Name]
     result = ""   

   if Not IsNull(var) then
     splitStr = Split(var, chr(32))

     for i = 0 to UBound(splitStr)
       tmpStr = Trim(splitStr(i))
         if len(tmpStr) > 0 then 
           if result = "" then
              result = tmpStr 
           else
              result = result & vbnewline & tmpstr    
          end if
        end if
     splitStr(i) = tmpStr  
     next
   FindLabel = result
 End Function

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.