I have multiple feature classes in a geodatabase, each feature class has metadata including a Description, Credits, and other information. If I use the 'Add Data' button in ArcMap 10.1 to add one of feature classes then that metadata is imported into the layer description. Ie, I view the layer properties and Description, Credits, etc., are filled in. However, if I use arcpy and add the feature class using MakeFeatureLayer_management
and AddLayer
then that metadata is not imported.
Does anyone know if its possible to get that full functionality of feature classes and their description, credits, etc to load with arcpy? Am I doing something wrong? Or, must I export the metadata, read the sections I want, and add that text to the layer file?
As requested, a code sample is:
mxd=arcpy.mapping.MapDocument(path_to_blankmxd)
df = arcpy.mapping.ListDataFrames(mxd,"Layers")[0]
arcpy.MakeFeatureLayer_management(featureclass_sde,activation+"_"+featureclass)
addLayer=arcpy.mapping.Layer(activation+"_"+featureclass)
addLayer.name=layername
arcpy.mapping.AddLayer(df,addLayer)
The feature class to be inserted in the MXD is 'featureclass_sde' with full metadata. However, once its inserted all metadata is lost. At present I am exporting metadata as XML, parsing XML to get metadata elements (description, source, etc), and then inserting those elements into the MXD. It works but seems so.... wrong....