Access and update map and layer metadata (arcpy.mp)

1790
7
07-23-2018 11:56 AM
BenJenkins
New Contributor II

Id like to edit map and layer metadata like description and such with arcpy.mp. I knew how to do it with arcgis.mapping but can't find the documentation for pro.  

0 Kudos
7 Replies
DanPatterson_Retired
MVP Emeritus

If you could post what you were using, an equivalent might be found, however, start here

ArcGIS Pro Python Reference—ArcGIS Pro | ArcGIS Desktop 

Then check the classes and functions

Alphabetical list of arcpy.mp classes—ArcPy | ArcGIS Desktop 

Alphabetical list of arcpy.mp functions—ArcPy | ArcGIS Desktop 

BenJenkins
New Contributor II

The method I'm familiar with would look something like this. 

import arcpy 

mp = arcpy.mapdocumnet(<path to mxd>)

print mp.description

0 Kudos
BenJenkins
New Contributor II

The arcpy.mp.ListMaps() returns a map object. I've reviewed the documentation and while the map when viewed in pro has a description parameter in the metadata tab, there doesn't seem to be a description parameter to the resulting map object like there was for the map document object. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

I don't see a direct 1:1 mapping, but the documents are clear that things have moved around, or been split and the figure in this link

Migrating from arcpy.mapping to ArcGIS Pro—ArcPy | ArcGIS Desktop 

shows the main breakdown and inter-relationships from the project class

ArcGISProject—ArcPy | ArcGIS Desktop 

And metadata tools are coming 

Tools that are not available in ArcGIS Pro—Appendices | ArcGIS Desktop 

there is a link there about when.  So perhaps the metadata tool absence has a direct impact on arcpy's presentation of options

Good luck Ben

BenJenkins
New Contributor II

Yes I've reviewed the documentation. But while there's mention of metadata there's no mention of how to read or edit it. 

0 Kudos
DanPatterson_Retired
MVP Emeritus

metadata tools … they are absent in PRO which may account for there being no Arcpy metadata access

0 Kudos
NeilFordyce
New Contributor III

I use arcpy_metadata from Github to bulk edit metadata using Python e.g.

Import arcpy_metadata as MET

md = MET.MetadataEditor(dataset)

md.title = 'SRTM 30M Digital Elevation Model Raw Data'

md.tags = ['Topography','DEM','RAW','Papua New Guinea', Western Province','NASA','02/2000']

md.purpose = 'Terrain modelling and mapping'

md.limitation = 'No current limitations are known with this data'

md.finish()

Can't edit everything but if you have a suite of well named data sets you can iterate through creating metadata for all of them.

For bulk creating thumbnails I use a clunky C# tool in ArcCatalog. There seems to be no provided tool to do this tedious task.