POST
|
I did confirm that if a feature class had the exact same name as the feature dataset, the features were left out of the list. It would list the feature dataset as it appeared, but no feature classes were shown. I had to either change the name of the dataset or the feature class for the script to work correctly.
... View more
10-14-2011
12:39 PM
|
1
|
0
|
992
|
POST
|
All, I just wanted to address two small issues with this script I have encountered: First, the script works great in the Python window in ArcMap/ArcCatalog, but produces errors in Pythonwin: (ExecuteError: Failed to execute. Parameters are not valid. ERROR 000816: The tool is not valid. Failed to execute (ExportMetadata). Second, if the name of your feature class has the same name as the feature dataset it resides in, it will cause the script to fail. (ex. - Data.gbd>Contours>Contours) Will also terminate if no text is found in the metadata component it is looking for. I just wanted to let anyone who may use this script to be aware of these issues. Josh
... View more
08-08-2011
11:49 AM
|
1
|
0
|
588
|
POST
|
Beautiful! That did it. Thanks Curtis for all your help and everyone else who contributed. Also, the indention to distinguish datasets from feature classes was a nice touch. Hadn't thought of that... Josh
... View more
08-02-2011
07:10 AM
|
0
|
0
|
588
|
POST
|
Sorry, Curtis. I didn't realize the format doesn't carry over into the message. Lesson learned. Sending the code as an attachment. Thanks, Josh
... View more
07-29-2011
01:03 PM
|
0
|
0
|
754
|
POST
|
All, I brushed up on Python a little and attempted to tackle this script again. I have had some success in that I can now generate a list of feature classes and the "Summary" component of the metadata for all features in a feature dataset. The script below will produce that information. import arcpy, sys from xml.etree.ElementTree import ElementTree from arcpy import env env.overwriteOutput = True env.workspace = r"D:\Lakeland_GIS\GDB\Lakeland\Lakeland.gdb\AddPoints" translatorpath = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\Metadata\Translator\ARCGIS2FGDC.xml" xmlfile = r"U:\my docs\GIS Projects\Python\Scripts\List Metadata\working_test.xml" datasetList = arcpy.ListDatasets() datasetList.sort() for dataset in datasetList: print dataset fcList = arcpy.ListFeatureClasses() fcList.sort() for fc in fcList: arcpy.ExportMetadata_conversion(fc, translatorpath, xmlfile) tree = ElementTree() tree.parse(xmlfile) spot = tree.find("idinfo/descript/purpose") print fc print spot.text What I am attempting to do is generate a list of all feature classes, by dataset, for an entire geodatabase. Ex. - (Dataset>Feature Class>Metadata). As of now I can only get FeatureClass>Metadata for one feature dataset at a time. Help! If anyone could help me complete this I would be truly appreciative. Thanks, Josh
... View more
07-29-2011
11:30 AM
|
0
|
0
|
754
|
POST
|
Thanks Curtis, but I'm afraid this code is beyond my skill level. I think I have gotten in over my head with this and need some more practice time with Python before trying this again. Thanks again for your help. Josh
... View more
06-23-2011
11:03 AM
|
0
|
0
|
754
|
POST
|
Darren, When I attempted to use the code you supplied, it simply moves to a new prompt. No errors, no output, nothing. Just a new prompt. Curtis, I am getting the same error.
... View more
06-22-2011
11:40 AM
|
0
|
0
|
754
|
POST
|
Here is the script I used (per dkwiens) to extract and print the "Description" portion of the metadata for an individual feature class: import arcpy, sys from xml.etree.ElementTree import ElementTree from xml.etree.ElementTree import Element, SubElement from arcpy import env env.overwriteOutput = True fcpath = r"D:\GIS\GDB\Lakeland\Lakeland.gdb\AddPoints\AddressPts" # the input feature class translatorpath = r"C:\Program Files (x86)\ArcGIS\Desktop10.0\Metadata\Translator\ARCGIS2FGDC.xml" # the translator file to use - it should be in an installed folder like this xmlfile = r"D:\GIS\metadata\test.xml" # the output xml file arcpy.ExportMetadata_conversion(fcpath, translatorpath, xmlfile) # export the metadata to xml tree = ElementTree() # make an ElementTree object tree.parse(xmlfile) # read the xml into the ElementTree spot = tree.find("idinfo/descript/abstract") # find whatever tag you want print spot.text # print the text between the tags If you can help me tie this into the fcList script, I will be indebted to you. Josh
... View more
06-21-2011
12:53 PM
|
0
|
0
|
2160
|
POST
|
Hey Guys, Thanks for the help. So far, all the info you have given me has worked very well. I am able to list the "Description" portion of the metadata for an individual feature class. Is there a way to integrate this code with the "Listfc" script? My ultimate goal is to list all feature classes, by dataset, and their respective metadata from a file GDB to give to staff in various dept. I am a beginner and am just not able to make this work on my own. I appreciate any help you can give. Josh
... View more
06-21-2011
10:37 AM
|
1
|
0
|
2160
|
POST
|
I have a list of feature classes from a geodatabase I created from a Python script and would like to add their respective metadata or a portion of (such as the description portion of the ArcGIS metadata style) to this list by feature class. Is this possible with Python or am I asking too much? Thanks, Josh
... View more
06-20-2011
01:00 PM
|
3
|
36
|
15256
|
POST
|
Hey Chris, I came to the same confusing conclusion. When the feature name contains the dataset name, it kicks it and all other features in that dataset out. Strange...but probably something in my code. The features are stored in a file geodatabase, v10 (sp2). Below is the code I am using: import arcpy arcpy.env.workspace = "D:\Lakeland_GIS\GDB\Lakeland\Lakeland.gdb" datasetList = arcpy.ListDatasets("*", "Feature") datasetList.sort() for dataset in datasetList: print dataset fcList = arcpy.ListFeatureClasses("*","",dataset) fcList.sort() for fc in fcList: print fc Thanks, Josh
... View more
06-13-2011
06:29 AM
|
0
|
0
|
992
|
POST
|
Curtis, Someone else actually mentioned this as a way to get familiar with Python. I think after this exercise, I will certainly try that. Thanks for your reply. Josh
... View more
06-09-2011
07:54 AM
|
0
|
0
|
3608
|
POST
|
Chris, I do have some topologies included in the geodatabase, however, I do not want them to print, so that is actually a positive outcome. I am referring specifically to feature classes that are not being listed. I have included an excel file with the geodatabase contents compared to the outcome of the fcList, with some formatting to easily compare results. Thanks for the help. Josh
... View more
06-09-2011
07:53 AM
|
1
|
0
|
3608
|
POST
|
Okay, we are making progress. Thanks so much for your help. I now have a new problem: Within the list, some of the feature classes are not included. All the feature datasets are included, but randomly, the feature classes will be missing from the dataset. I am one tier below beginner when it comes to Python, so any help is greatly appreciated. Thanks, Josh
... View more
06-08-2011
11:31 AM
|
0
|
0
|
3608
|
POST
|
Thanks for the quick response. I've been out of the office for a week, so my apologies for the delayed response. The script worked fine, so thanks for that. I do have one question, though. It generated a list in random order, not in alphabetical order as they are shown in the geodatabase. Do you know why this happens? Thanks again for your help, Josh
... View more
06-07-2011
01:33 PM
|
1
|
0
|
3608
|
Title | Kudos | Posted |
---|---|---|
1 | 08-08-2011 11:49 AM | |
1 | 06-21-2011 10:37 AM | |
1 | 10-14-2011 12:39 PM | |
1 | 06-09-2011 07:53 AM | |
1 | 06-07-2011 01:33 PM |
Online Status |
Offline
|
Date Last Visited |
06-05-2023
02:58 PM
|