1

I had run the contour tool in my script to generate polylines.

Contour("rectExtract", "C:/fakepath/Class1.shp", 50,0)

Now I want to label the polylines with the contour-value. If I execute this script:

layer = arcpy.mapping.ListLayers(IMXD, "")[1]
layer.showLabels=True
arcpy.RefreshActiveView()

it will label the polylines with the ID-Value.

How can I change this?

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Aug 1, 2013 at 11:52

1 Answer 1

3

If you have only one label class it's

layer.labelClasses[0].expression = "[<field expression here>]"
layer.showLabels = True
arcpy.RefreshActiveView()

Tested in ArcGIS 10.1

answered Aug 1, 2013 at 12:07

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.