One attribute field, two words. How to distribute for labeling?
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
if len (st) > 0 then
LabStr = LabStr & " " & st
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
If you would like to post a comment, please login.