<?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 Dictionary from .get_data() doesnt recognize key that exists in dictionary in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/dictionary-from-get-data-doesnt-recognize-key-that/m-p/1516362#M10411</link>
    <description>&lt;P&gt;Hello, I'm very confused on how to modify the JSON of the actual web map. I have a user who is not really a GIS person and has little interest in developing those skills so I'm just trying to automate the entire process but it is actually really difficult to modify the various elements of the actual map. I've tried to follow &lt;A href="https://developers.arcgis.com/python/samples/using-and-updating-GIS-content/" target="_self"&gt;this&lt;/A&gt; but it just doesn't behave in the same way even when I'm doing basically the same thing with a WebMap instead of a WebScene.&lt;BR /&gt;&lt;BR /&gt;Below is my code and it will get to the part where it is checking the layer's itemId so I modify the correct layer. However, python doesn't seem to think that there is an itemId key in the web_map_obj dictionary but there very much is and when I print web_map_obj I can see there is an itemId key. What gives?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS('home')

web_map_item = gis.content.get('0b442333de0544569191341e5e64dbad')
web_map_obj = web_map_item.get_data()

display(web_map_obj)
subset_op_layers = [subset for subset in web_map_obj['operationalLayers']]

for layer in subset_op_layers:
    display(layer.keys())
    if layer['itemID'] == '9aa6edefe3dd45febafddffe71d07ca5':
        popup_info = layer['popupInfo']
        layer['popupInfo']['title'] = '{Clinic_Sit}'
        layer['popupInfo']['fieldInfos'][0]['visible'] = False
        layer['popupInfo']['fieldInfos'][1]['label'] = 'Agency Name'
        layer['popupInfo']['fieldInfos'][2]['visible'] = False
        layer['popupInfo']['fieldInfos'][3]['label'] = 'Street Address'
        layer['popupInfo']['fieldInfos'][9]['label'] = 'Website'
        layer['popupInfo']['fieldInfos'][10]['label'] = 'Hours of Operation'
        layer['popupInfo']['fieldInfos'][11]['label'] = 'Accepting New Patients'
        layer['popupInfo']['fieldInfos'][12]['label'] = 'Schedule an Appointment By'
        layer['popupInfo']['fieldInfos'][13]['label'] = 'Bilingual Medical Provider (Yes/No)'
        layer['popupInfo']['fieldInfos'][14]['label'] = 'Bilingual Medical Provider Language'
        layer['popupInfo']['fieldInfos'][15]['label'] = 'Onsite Interpretation Services (Yes/No)'
        layer['popupInfo']['fieldInfos'][16]['label'] = 'Onsite Interpretation Services Language'
        layer['popupInfo']['fieldInfos'][17]['label'] = 'Telehealth Interpretation Services (Yes/No)'
        layer['popupInfo']['fieldInfos'][18]['label'] = 'Telehealth Interpretation Services Language'
        layer['popupInfo']['fieldInfos'][19]['visible'] = False
        layer['popupInfo']['fieldInfos'][20]['visible'] = False
        
new_web_map_properties = web_map_properties
new_web_map_properties['text'] = json.dumps(new_web_scene_obj)

# new_item = gis.content.add(new_web_map_properties)
# new_item&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;output of layer.keys():&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dict_keys(['title', 'opacity', 'visibility', 'id', 'layerDefinition', 'layerType', 'itemId', 'url', 'popupInfo'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 23:27:12 GMT</pubDate>
    <dc:creator>ChrisCowin_dhs</dc:creator>
    <dc:date>2024-08-07T23:27:12Z</dc:date>
    <item>
      <title>Dictionary from .get_data() doesnt recognize key that exists in dictionary</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/dictionary-from-get-data-doesnt-recognize-key-that/m-p/1516362#M10411</link>
      <description>&lt;P&gt;Hello, I'm very confused on how to modify the JSON of the actual web map. I have a user who is not really a GIS person and has little interest in developing those skills so I'm just trying to automate the entire process but it is actually really difficult to modify the various elements of the actual map. I've tried to follow &lt;A href="https://developers.arcgis.com/python/samples/using-and-updating-GIS-content/" target="_self"&gt;this&lt;/A&gt; but it just doesn't behave in the same way even when I'm doing basically the same thing with a WebMap instead of a WebScene.&lt;BR /&gt;&lt;BR /&gt;Below is my code and it will get to the part where it is checking the layer's itemId so I modify the correct layer. However, python doesn't seem to think that there is an itemId key in the web_map_obj dictionary but there very much is and when I print web_map_obj I can see there is an itemId key. What gives?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;gis = GIS('home')

web_map_item = gis.content.get('0b442333de0544569191341e5e64dbad')
web_map_obj = web_map_item.get_data()

display(web_map_obj)
subset_op_layers = [subset for subset in web_map_obj['operationalLayers']]

for layer in subset_op_layers:
    display(layer.keys())
    if layer['itemID'] == '9aa6edefe3dd45febafddffe71d07ca5':
        popup_info = layer['popupInfo']
        layer['popupInfo']['title'] = '{Clinic_Sit}'
        layer['popupInfo']['fieldInfos'][0]['visible'] = False
        layer['popupInfo']['fieldInfos'][1]['label'] = 'Agency Name'
        layer['popupInfo']['fieldInfos'][2]['visible'] = False
        layer['popupInfo']['fieldInfos'][3]['label'] = 'Street Address'
        layer['popupInfo']['fieldInfos'][9]['label'] = 'Website'
        layer['popupInfo']['fieldInfos'][10]['label'] = 'Hours of Operation'
        layer['popupInfo']['fieldInfos'][11]['label'] = 'Accepting New Patients'
        layer['popupInfo']['fieldInfos'][12]['label'] = 'Schedule an Appointment By'
        layer['popupInfo']['fieldInfos'][13]['label'] = 'Bilingual Medical Provider (Yes/No)'
        layer['popupInfo']['fieldInfos'][14]['label'] = 'Bilingual Medical Provider Language'
        layer['popupInfo']['fieldInfos'][15]['label'] = 'Onsite Interpretation Services (Yes/No)'
        layer['popupInfo']['fieldInfos'][16]['label'] = 'Onsite Interpretation Services Language'
        layer['popupInfo']['fieldInfos'][17]['label'] = 'Telehealth Interpretation Services (Yes/No)'
        layer['popupInfo']['fieldInfos'][18]['label'] = 'Telehealth Interpretation Services Language'
        layer['popupInfo']['fieldInfos'][19]['visible'] = False
        layer['popupInfo']['fieldInfos'][20]['visible'] = False
        
new_web_map_properties = web_map_properties
new_web_map_properties['text'] = json.dumps(new_web_scene_obj)

# new_item = gis.content.add(new_web_map_properties)
# new_item&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;output of layer.keys():&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;dict_keys(['title', 'opacity', 'visibility', 'id', 'layerDefinition', 'layerType', 'itemId', 'url', 'popupInfo'])&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 23:27:12 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/dictionary-from-get-data-doesnt-recognize-key-that/m-p/1516362#M10411</guid>
      <dc:creator>ChrisCowin_dhs</dc:creator>
      <dc:date>2024-08-07T23:27:12Z</dc:date>
    </item>
    <item>
      <title>Re: Dictionary from .get_data() doesnt recognize key that exists in dictionary</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/dictionary-from-get-data-doesnt-recognize-key-that/m-p/1516558#M10412</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/800827"&gt;@ChrisCowin_dhs&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Your...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layer['itemID']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Should be...&lt;/P&gt;&lt;LI-CODE lang="python"&gt;layer['itemId']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lowercase d at the end.&lt;/P&gt;&lt;P&gt;All the best,&lt;/P&gt;&lt;P&gt;Glen&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2024 08:36:08 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/dictionary-from-get-data-doesnt-recognize-key-that/m-p/1516558#M10412</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-08-08T08:36:08Z</dc:date>
    </item>
  </channel>
</rss>

