POST
|
Thanks Curtis, I was just reading through this previous post about metadata. It seems like a simple thing; but it's more involved. http://forums.arcgis.com/threads/33080-List-metadata-with-Python Thanks for the assistance. -andy
... View more
01-02-2013
01:55 PM
|
0
|
0
|
605
|
POST
|
There are hundreds of sde and fgdb featureclasses and many of them have readable English metadata descriptions associated with them which I want to retrieve along with the featureclass names by looping through all the datasets and featureclasses. I'd rather not do it through ArcObjects VBA so I thought maybe python. The only way I've found so far is
for lyr in arcpy.mapping.ListLayers(mxd):
print lyr.description
And it seems to work, almost. If I add a featureclass to the map manually this print statement returns the same text I put into the ArcCatalog description of it:
#Hi andy how to retrieve this text from ArcCatalog Description Tab.
If I add the exact same featureclass to the map programmatically as shown above this same print statement returns the file path instead of the text description:
#C:\temp\....\ADMIN_BOUNDARY\AZ_cnty_bnd_100_lyr
Perhaps my terminology is wrong? "there is no description on a FC object" There are descriptions for the featureclasses even if it�??s not exposed directly as a property on the FC object. I can read them. I could copy/paste them into a table from ArcCatalog perhaps. However, there are a lot of them and they change sometimes, so it's best to do it programmatically. There must be someway and your help is appreciated if you have any ideas. [ATTACH=CONFIG]20387[/ATTACH]
... View more
01-02-2013
01:14 PM
|
0
|
0
|
605
|
POST
|
Jeff, Thank you for the clear restatement of the problem. Is the metadata .description of the featureclass itself available through python rather than from the layer object? I've searched many posts and help documents but haven't yet found the right snippit of code to get it to work. If I drag and drop the layer into ArcMap from ArcCatalog the featureclass description is available in the layer description (as shown in the print statement posted above); but when I add the featureclass to the map programmatically the featureclass description gets overwritten by the file path in the layer object. There must be something simple I'm missing to access the featureclass .description programmatically. Thanks for your help with it. -Andy
... View more
01-02-2013
08:25 AM
|
0
|
0
|
605
|
POST
|
Why when I add a layer programmatically does the featureclass description visible in ArcCatalog disappear? #Is the .description of the featureclass itself available rather than from the layer object? print str(cnt) + ", " + fd + ", " + fc + ", " + str(count) + ", " + layname + ", " + dattype + ", " + typedat mxd = arcpy.mapping.MapDocument("C:\\temp\\test.mxd") arcpy.env.workspace = gdb + '\\' + fd base_Folder = arcpy.env.workspace df = arcpy.mapping.ListDataFrames(mxd, "*")[0] outlayer = os.path.join(base_Folder, fc) + "_lyr" layerfile = "C:\\temp\\" + fc + ".lyr" arcpy.MakeFeatureLayer_management(os.path.join(base_Folder, fc), outlayer) arcpy.SaveToLayerFile_management(outlayer, layerfile, "ABSOLUTE") addLayer = arcpy.mapping.Layer(outlayer) arcpy.mapping.AddLayer(df, addLayer, "BOTTOM") arcpy.RefreshTOC() arcpy.RefreshActiveView() for lyr in arcpy.mapping.ListLayers(mxd): print lyr.description mxd.save() del mxd ##Output Line1(First Print Statement is okay): #1, ADMIN_BOUNDARY, AZ_cnty_bnd_100, 15, n, Simple, Polygon ##Output Line2(Second Print Statement Same Layer Dropped from Arc Catalog, is okay): #Hi andy how to retrieve this text from ArcCatalog Description Tab. ##Output Line3(Second Print Statement Same Layer Added with .Addlayer, description disappears): #C:\temp\awstmp_serverprj_bak\R9GDL_Data_WM\R9GDL_WM.gdb\ADMIN_BOUNDARY\AZ_cnty_bnd_100_lyr
... View more
12-27-2012
01:30 PM
|
0
|
8
|
2927
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:24 AM
|