3

Is there a way to edit a shapefile's Item Description > Summary in ArcPy?

I can right click on the shapefile in catalog, select Item Description, then click edit... but I want to automate this in arcpy. I also want to keep the default metadata format. Screenshot below is example of default metadata format, with my manual edits to Summary (not done in arcpy).

enter image description here

1 Answer 1

1

With pure ArcPy the way to do this is to save a copy of the item's metadata to an XML file, modify it, then save the XML back to the original ArcGIS item. From the documentation:

Another approach is to use a Python script to update an item's metadata content. The Python script must execute the same geoprocessing tools as the model described above that processes metadata using an XSLT stylesheet. The XSLT Transformation tool is used first to save a copy of the item's metadata to an XML file using the exact copy of.xslt stylesheet provided with ArcGIS Desktop. The resulting XML file can be modified with a Python script. Then, the updated XML document must be saved back to the original ArcGIS item as its metadata using the Metadata Importer tool.

There is a 3rd party python library that automates this - Arcpy Metadata Editor (arcpy_metadata)

Note if using ArcGIS Desktop, these metadata tools are only available in 32bit Python (i.e. not the 64bit background geoprocessing python)

2
  • This arcpy_metadata package worked well! I am running ArcMap 10.6, and I converted my .py into a toolbox tool. Works like a charm, many thanks.
    – a11
    Sep 8, 2018 at 1:00
  • Small note: I had to install pip first, and then intall the arcpy_metadata package from command prompt to get it to run in my ArcMap tool. Initally, I was able to easily install the arcpy_metadata package in PyCharm and get it to run, but apparently the directory to which it was installed was not mapped by Arc(?). In case anyone has the same question, I followed the pip install instructions here (half way down the page): github.com/BurntSushi/nfldb/wiki/…
    – a11
    Sep 8, 2018 at 1:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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