Ask A Cartographer

One attribute field, two words. How to distribute for labeling?

December 23 2010 | 1 comment
Categories: ArcGIS Methods, Map Data

Hello! My street names are recorded as three fields: the first has a directional designation (N, E, W, S). The second has the name (Maple, Washington), and the third has the type (Road, Avenue). In some instances, the name field has two words: "Silverado Ranch." In this case, Maplex identifies it as too long to fit, and omits it in accordance with the conflict rules I have written. However, if it could recognize that "Silverado" and "Ranch" can be placed several blocks apart from one another, there would be plenty of room. How can I communicate this to Maplex? Thank you!

Mapping Center Answer:

You can use a codeblock calculate script to do this.  Here is a VBScript that will do what you want.

pd = trim( [PRE_DIR] )
sn = trim ( [STREET_NAM] )
st = trim ( [STREET_TYP] )
LabStr = sn
if len(pd) > 0 then
  LabStr = pd & " " & LabStr
end if
if len (st) > 0 then
  LabStr = LabStr & " " & st
end if

Set the field name =  LabStr

This is set up to use the trim() function with removes leading and trailing spaces (a common problem in street datasets).  If you have a suffix direction field as well, the script would look like this:

pd = trim( [PRE_DIR] )sn = trim ( [STREET_NAM] )st = trim ( [STREET_TYP] )sd = trim ( [SUFFIX_DIR] )
LabStr = snif len(pd) > 0 then  LabStr = pd & " " & snend ifif len (st) > 0 then  LabStr = LabStr & " " & stend if
if len (sd) > 0 then  LabStr = LabStr & " " & sdend if

Follow up to above script posted by Marianne Farretta on Dec 27 2010 2:21PM
Hello, and thank you! One question: you write, "Set the field name - LabStr." Which field name are you referring to? Thank you!

If you would like to post a comment, please login.

Contact Us | Legal | Privacy |