2

I'm using ArcPy to get the current aprx, active map, then to create an empty metadata object, and populate it with values from a fGDB table, but I cant copy and save it back to the read only map metadata object.

I'm using the metadata object as documented at Metadata in the ArcGIS Pro Online Help.

m = aprx.activeMap
m.name = Title #set the map elements name to the same as the title
# create empty metadata object and populate it with our varibles
new_md = md.Metadata()
new_md.title = 'Title'
new_md.tags = 'Tag1, Tag2'
new_md.summary = 'Summary'
new_md.description = 'Description'
new_md.credits = 'My Credits'
activemap_metadata = md.Metadata(m) #the metadata object for the active map
if activemap_metadata.isReadOnly:
 arcpy.AddMessage("the metadata object for the active map is read only")
else:
 activemap_metadata.copy(new_md)
 activemap_metadata.save()

I'm open to ideas

PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Aug 8, 2022 at 3:23

2 Answers 2

1

Replace the line:

activemap_metadata = md.Metadata(m)

with the line:

activemap_metadata = m.metadata

answered Aug 8, 2022 at 12:59
0
0

This works; @Brennan

 m = aprx.activeMap
 m.name = Title 
 map_metadata = m.metadata 
 map_metadata.title = Title
 map_metadata.summary = Summary 
 map_metadata.description = Description
 map_metadata.tags = Tag
 map_metadata.credits = Credits
 map_metadata.accessConstraints = Terms
 map_metadata.save()
GforGIS
3,3954 gold badges23 silver badges40 bronze badges
answered Aug 9, 2022 at 3:01

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.