Select to view content in your preferred language

Labelling in ArcMap 10

1233
5
11-01-2011 04:51 AM
SimonKettle
Frequent Contributor
I am looking to label points on a map however the text is rather long and when put onto a stand label in ArcMap is very long and not very good looking.

Is there a way of putting a return in the middle (or after a specified number of characters) of a text field using the VB Script in the labels tab of a layers properties?

Thanks for any help!
Tags (2)
0 Kudos
5 Replies
JimW1
by
Frequent Contributor
I am looking to label points on a map however the text is rather long and when put onto a stand label in ArcMap is very long and not very good looking.

Is there a way of putting a return in the middle (or after a specified number of characters) of a text field using the VB Script in the labels tab of a layers properties?

Thanks for any help!


This code will split the label in half:
Function FindLabel ( [name] )
firsthalf =   left([name],len([name])/2)
secondhalf = right([name],len([name])/2)
FindLabel = firsthalf & vbnewline & secondhalf
End Function


It's not ideal but should but is the basic syntax that can be built upon.

So for my test label it shows:
"This is a very long label for rea
lly only needing to label Toronto"
0 Kudos
SimonKettle
Frequent Contributor
Thank you very much...I am not very good at constructing syntax so will have a go at building on it.

Cheers again.
0 Kudos
JimW1
by
Frequent Contributor
Thank you very much...I am not very good at constructing syntax so will have a go at building on it.

Cheers again.


Another trick I have done for well labels is to make a table in Excel and use the much quicker/easier Excel commands to format the text strings. Then make a copy of your table using 'Paste Values' to get rid of the formulas.

Now in ArcMap just join your Excel table to the base data and use the text string field from the join table (the Excel table) in your map.

I had one project where I had to label the top 3 offending parameters for drinking water wells and that would be absolute torture to try and code in VB Script - if it is even possible. I used nested IF statements in Excel to make the label strings and did the join trick to label the map.
0 Kudos
JoshuaDamron
Deactivated User
Looks like you are getting some great ideas.  I'll chip in with one more which uses VB.

In the labeling expression field type "VbNewline" to move a field to another line of text in the label. The basic expression is: [Field 1] & vbNewline & [Field 2]

In the following example the Install date is on a separate line:

[W_DIAMETER] & "'' " & [W_TYPE] & VbNewline & [W_INSTALL]

The above creates a label like this:

8" Cast Iron
1956

I wish you the best.
0 Kudos
SimonKettle
Frequent Contributor
Thanks for all your help...I will have a look at utilising all your ideas.

Thanks again for all your help!
0 Kudos