Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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]

it will label the polylines with the ID-Value. How can I change this?

Thanks for your help.

share|improve this question
up vote 2 down vote accepted

If you have only one label class it's

layer.labelClasses[0].expression = "[<field expression here>]"
layer.showLabels = True

Tested in ArcGIS 10.1

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.