3

I am trying to populate the properties of a feature class in a geodatabase using arcpy. In the past I have been given geodatabases with features classes that already have their property descriptions filled in.

How do you populate the description of a feature class using ArcPy?

I cannot seem to locate the information. Below is an example of what I am trying to achieve. This feature class "Wetland Protection Area" comes from a .gdb and its description has already been populated.

enter image description here

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Feb 2, 2015 at 22:44

2 Answers 2

3

The layer class in the arcpy.mapping module has the ability to read and write layer descriptions, as well as access several other properties for the layer.

There are several examples in the help page which should get you going.

I'm not sure how you'd get the different descriptions for all your layers, but supposing you have descriptions ready to go, you could do something like this:

mxd = arcpy.mapping.MapDocument(r"C:\Project\ServerData.mxd")
layer_desc = "This is an example layer description."
for lyr in arcpy.mapping.ListLayers(mxd):
 layer.description = layer_desc
answered Feb 2, 2015 at 23:09
2

You can set the description using the ArcPy mapping module - specifically the Layer class. The Layer class has a description property.

So, changing the Layer description would look like this:

mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
layer = arcpy.mapping.ListLayers(mxd, "Wetland Protection Area", df)[0]
layer.description = "Enter your description here"
answered Feb 2, 2015 at 23:10

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.