1

I am trying to create a descriptive database catalog by implementing the great solution described here. This user's solution creates a csv file that identifies a geodatabase's content, including elements from its metadata. In the GetMetadataItems function of this user's script, the abstract and purpose metadata items are accessed by using the elements as "idinfo/descript/abstract" and "idinfo/descript/purpose", as shown below in a portion of user's script.

def GetMetadataItems(dataset):
    """Retrieves certain metadata text elements from the specified dataset"""
    tree = GetMetadataElementTree(dataset)
    originator = GetElementText(tree, "idinfo/citation/citeinfo/origin") # Originator
    pocorg = GetFirstElementText(tree, ("idinfo/ptcontac/cntinfo/cntperp/cntorg", # Point of contact organization (person primary contact)
                                    "idinfo/ptcontac/cntinfo/cntorgp/cntorg"))      # Point of contact organization (organization primary contact)
    abstract = GetElementText(tree, "idinfo/descript/abstract") # Abstract
    purpose = GetElementText(tree, "idinfo/descript/purpose") # Purpose
    searchkeys = ListElementsText(tree, "dataIdInfo/searchKeys/keyword") # Search keywords
    themekeys = ListElementsText(tree, "idinfo/keywords/theme/themekey") # Theme keywords
    del tree
    metadataItems = (originator, pocorg, abstract, purpose, searchkeys, themekeys)
    return metadataItems

When I run this script, however, most of the values for the purpose and abstract columns are blank. I have tried to change these strings to read "ItemDescription/idCitation/idAbs" and "ItemDescription/idCitation/idPurp" as well as "idCitation/idAbs" and "idCitation/idPurp" My guess is that this tool is not working for me because of this portion of the script. How can I make sure the script is able to access these metadata items in my geodatabase?

Perhaps I need to ensure the definitions in the GetMetadataItems function adhere to the specific metadata format of my geodatabase.

  • 1
    Have you verified that these fields have been been populated? These fields are not required, and may not contain information. – Barbarossa Mar 13 '17 at 17:52
  • I have @Barbarossa. – reevesii Mar 13 '17 at 18:22
1

Which metadata style are you using?

The code seems to be looking for FGDC schema items. Here is a snippet of some of the paths.

When I ran it, my output was ArcGIS XML. For example, purpose was: dataIdInfo/idPurp

Finding the definitive list of paths for the ArcGIS XML schema has been difficult, but this Github project has a nice list of paths under the supported items section. The project may be more in line with what you are looking for as well.

Another trick would be to debug within the GetMetadataElementTree function. Remove the line os.remove(xmlfile) temporarily and all the XML files created from the MetadataImporter_conversion call will be available. You can inspect these and figure out the paths needed.

  • It was an issue between the metadata format of my data and the definitions in the GetMetadataItems function. Other elements, such as <DIV STYLE=""text-align:Left;""><DIV><P have been added to spreadsheet. Any idea how to get rid of this? – reevesii Mar 14 '17 at 15:33
  • Not exactly sure, but take a look for some code to strip out HTML, like: stackoverflow.com/a/925630/2258 – Richard Morgan Mar 14 '17 at 17:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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