label expression

2495
16
Jump to solution
10-06-2014 09:32 AM
SiranErysian
New Contributor

I have a attribute table for contours every 10 feet but would like to label ONLY the major contours using the value specified in the Contour field. Found some similar messages but  can't get the syntax correct. Please help. New to Python.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
JamesCrandall
MVP Frequent Contributor

ArcGIS Help 10.1  "Placing labels for contours" should do what you want.

View solution in original post

0 Kudos
16 Replies
JamesCrandall
MVP Frequent Contributor

ArcGIS Help 10.1  "Placing labels for contours" should do what you want.

0 Kudos
SiranErysian
New Contributor

James,

Here is my modification. I have a string field called Line_typ which has the contours I want to label as major. Do I need to have an integer field like you do in the example and have values for each of the line types to choose a number for all those that are called major that I want to label or can I use that string field?

This did not work.

Siran

0 Kudos
SiranErysian
New Contributor

Tried this:

no luck

0 Kudos
JamesCrandall
MVP Frequent Contributor

Try to wrap your evaluation statement into quotes:

If [Lin_typ] = "major" Then

0 Kudos
SiranErysian
New Contributor

I created a field called index and used the value 1 for all major contours. See above. Still get error message about line 1 syntax

0 Kudos
JamesCrandall
MVP Frequent Contributor

Did you set the field type to Short Integer for the Index field?

I setup the same way and do not get any error.

0 Kudos
SiranErysian
New Contributor

I did set the index field to short integer.

0 Kudos
CoryMacNeil1
Occasional Contributor II

I am a big fan of label expressions but since the label expression does not seem to be working for you, why don't you try Label Classes.  Change the Method under the Labels tab to "Define classes of features and label each class differently".

Next, click on the SQL Query button to essentially do a Definition Query for [Lin_typ] = "Major".

Set your Label Field to be [Contour] and then setup the text symbology:

I hope this helps.

Cory

0 Kudos
SiranErysian
New Contributor

Right answer! much easier. Will I ever learn Python? I really think its cool...when it works! Thanks so much.

0 Kudos