<?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: How to preserve the symbology of feature layer using updating/overwriting features as described in  API documentation? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-preserve-the-symbology-of-feature-layer/m-p/1187848#M7531</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/469496"&gt;@RehanChaudhary&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Manually apply the symbology and then export the JSON. Print the JSON to screen using the snippet below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

agol = GIS("home")

item = agol.content.get("***item_id***")

lyr = item.layers[0]

print(json.dumps(lyr.properties["drawingInfo"], indent=4))&lt;/LI-CODE&gt;&lt;P&gt;Open a Notepad and add the below first, then copy and past the JSON output into the placeholder. Save the file with a .json file extension.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "drawingInfo" :
	*** copy and paste JSON here***
}&lt;/LI-CODE&gt;&lt;P&gt;This .json file is now your symbology template for the layer. You can apply the symbology using the code below every time you update. You can alter your current script and add similar code to update the symbology after the update.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

agol = GIS("home")

item = agol.content.get("***item_id***")

lyr = item.layers[0]

## open the JSON file
with open(r"C:\path\to\symbology.json") as json_data:
    data = json.load(json_data)

lyr.manager.update_definition(data)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 29 Jun 2022 15:28:24 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2022-06-29T15:28:24Z</dc:date>
    <item>
      <title>How to preserve the symbology of feature layer using updating/overwriting features as described in  API documentation?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-preserve-the-symbology-of-feature-layer/m-p/1142197#M7101</link>
      <description>&lt;P&gt;I am trying to write a script where i can overwrite or update a feature layer depending on the requirements on the arcgis portal from a csv file. I found these two methods under the python api documentation on this link:&lt;/P&gt;&lt;P&gt;&lt;A href="https://developers.arcgis.com/python/sample-notebooks/updating-features-in-a-feature-layer/" target="_blank"&gt;https://developers.arcgis.com/python/sample-notebooks/updating-features-in-a-feature-layer/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Both methods allow you to update or overwrite the contents of the feature layer but which one is able to preserve the symbology or is there any other way to preserve it?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Feb 2022 16:58:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-preserve-the-symbology-of-feature-layer/m-p/1142197#M7101</guid>
      <dc:creator>RehanChaudhary</dc:creator>
      <dc:date>2022-02-09T16:58:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to preserve the symbology of feature layer using updating/overwriting features as described in  API documentation?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-preserve-the-symbology-of-feature-layer/m-p/1187848#M7531</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/469496"&gt;@RehanChaudhary&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Manually apply the symbology and then export the JSON. Print the JSON to screen using the snippet below.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

agol = GIS("home")

item = agol.content.get("***item_id***")

lyr = item.layers[0]

print(json.dumps(lyr.properties["drawingInfo"], indent=4))&lt;/LI-CODE&gt;&lt;P&gt;Open a Notepad and add the below first, then copy and past the JSON output into the placeholder. Save the file with a .json file extension.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{
    "drawingInfo" :
	*** copy and paste JSON here***
}&lt;/LI-CODE&gt;&lt;P&gt;This .json file is now your symbology template for the layer. You can apply the symbology using the code below every time you update. You can alter your current script and add similar code to update the symbology after the update.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis import GIS
import json

agol = GIS("home")

item = agol.content.get("***item_id***")

lyr = item.layers[0]

## open the JSON file
with open(r"C:\path\to\symbology.json") as json_data:
    data = json.load(json_data)

lyr.manager.update_definition(data)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 29 Jun 2022 15:28:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-preserve-the-symbology-of-feature-layer/m-p/1187848#M7531</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2022-06-29T15:28:24Z</dc:date>
    </item>
  </channel>
</rss>

