<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Update map layer's metadata using arcpy in ArcGIS Pro Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165073#M54134</link>
    <description>&lt;P&gt;Did you check to see if it ....&amp;nbsp;&lt;SPAN&gt;isReadOnly ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/metadata/metadata-class.htm" target="_blank"&gt;Metadata—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Sun, 17 Apr 2022 22:30:15 GMT</pubDate>
    <dc:creator>DanPatterson</dc:creator>
    <dc:date>2022-04-17T22:30:15Z</dc:date>
    <item>
      <title>Update map layer's metadata using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165052#M54132</link>
      <description>&lt;P&gt;I am looking to bulk update metadata for each layer in my ArcGIS Pro's map. When I try to update it, it is not saved. I have tried two methods (see below code examples) but none work. I might be missing a step somewhere to save the metadata. Any help will be appreciated. Thanks.&lt;/P&gt;&lt;P&gt;Option 1:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import json
from arcpy import metadata as md

aprx = arcpy.mp.ArcGISProject(r"CURRENT")
m = aprx.listMaps(aprx.activeMap.name)[0]
metadata_json_orig = {}
metadata_json_new = {}
for lyr in m.listLayers():
    if lyr.isFeatureLayer:
        metadata_json_orig[lyr.metadata.title] = {"summary": lyr.metadata.summary, "description": lyr.metadata.description, "tags": lyr.metadata.tags, "credits": lyr.metadata.credits, "access_constraints": lyr.metadata.accessConstraints}
        item_md = md.Metadata(lyr)
        item_md.title = lyr.name
        item_md.summary = "My new layer's summary here"
        item_md.description = "My new layer's summary here"
        item_md.tags = "new,tag,list,here"
        item_md.credits = "Credit to me"
        item_md.accessConstraints = "You may use this layer"
        item_md.save()

        metadata_json_new[lyr.metadata.title] = {"summary": lyr.metadata.summary, "description": lyr.metadata.description, "tags": lyr.metadata.tags, "credits": lyr.metadata.credits, "access_constraints": lyr.metadata.accessConstraints}
print(f"{json.dumps(metadata_json_orig, indent=2)}\n#################################################\n")
print(f"{json.dumps(metadata_json_new, indent=2)}\n#################################################\n")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Option 2:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import arcpy
import json

aprx = arcpy.mp.ArcGISProject(r"CURRENT")
m = aprx.listMaps(aprx.activeMap.name)[0]
metadata_json_orig = {}
metadata_json_new = {}
for lyr in m.listLayers():
    if lyr.isFeatureLayer:
        metadata_json_orig[lyr.metadata.title] = {"summary": lyr.metadata.summary, "description": lyr.metadata.description, "tags": lyr.metadata.tags, "credits": lyr.metadata.credits, "access_constraints": lyr.metadata.accessConstraints}
        lyr.metadata.title = lyr.name
        lyr.metadata.summary = "My new layer's summary here"
        lyr.metadata.description = "My new layer's summary here"
        lyr.metadata.tags = "new,tag,list,here"
        lyr.metadata.credits = "Credit to me"
        lyr.metadata.accessConstraints = "You may use this layer"

        metadata_json_new[lyr.metadata.title] = {"summary": lyr.metadata.summary, "description": lyr.metadata.description, "tags": lyr.metadata.tags, "credits": lyr.metadata.credits, "access_constraints": lyr.metadata.accessConstraints}
print(f"{json.dumps(metadata_json_orig, indent=2)}\n#################################################\n")
print(f"{json.dumps(metadata_json_new, indent=2)}\n#################################################\n")&lt;/LI-CODE&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 19:47:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165052#M54132</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2022-04-17T19:47:50Z</dc:date>
    </item>
    <item>
      <title>Re: Update map layer's metadata using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165073#M54134</link>
      <description>&lt;P&gt;Did you check to see if it ....&amp;nbsp;&lt;SPAN&gt;isReadOnly ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://pro.arcgis.com/en/pro-app/latest/arcpy/metadata/metadata-class.htm" target="_blank"&gt;Metadata—ArcGIS Pro | Documentation&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Apr 2022 22:30:15 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165073#M54134</guid>
      <dc:creator>DanPatterson</dc:creator>
      <dc:date>2022-04-17T22:30:15Z</dc:date>
    </item>
    <item>
      <title>Re: Update map layer's metadata using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165109#M54137</link>
      <description>&lt;P&gt;isReadOnly is False for all my layers in my map.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 Apr 2022 09:38:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1165109#M54137</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2022-04-18T09:38:47Z</dc:date>
    </item>
    <item>
      <title>Re: Update map layer's metadata using arcpy</title>
      <link>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1188831#M56863</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/215600"&gt;@DanPatterson&lt;/a&gt;.&lt;/P&gt;&lt;P&gt;I had to have a look at this again and I think I found the issue.&lt;/P&gt;&lt;P&gt;It seems as though the geodatabase that my layer's metadata is being updated must be in the geodatabase that is set as default. I can update the metadata for the layer when it is in the default geodatabase. As soon as I set the default geodatabase to another geodatabase, it shows that the metadata's isReadOnly is False, but it does not update the metadata. This is the same if the geodatabase is a file or enterprise geodatabase.&lt;/P&gt;&lt;P&gt;I am not able to update the metadata of a query layer though. I set the default geodatabase to the enterprise geodatabase where my feature classes are being read from. This does show the metadata's isReadOnly is True for this query layer in the Pro map.&lt;/P&gt;&lt;P&gt;I would have thought that if I am updating the metadata for a layer in my Pro map it would not matter what the data source's workspace is as it is "attached" to the layer in the Pro map and not the feature class.&lt;/P&gt;</description>
      <pubDate>Fri, 01 Jul 2022 17:40:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-questions/update-map-layer-s-metadata-using-arcpy/m-p/1188831#M56863</guid>
      <dc:creator>julian_svcs</dc:creator>
      <dc:date>2022-07-01T17:40:16Z</dc:date>
    </item>
  </channel>
</rss>

