<?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 edit popupInfo properties for 'PropertyMap' type? in ArcGIS API for Python Questions</title>
    <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1373351#M9573</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/751607"&gt;@maya_fromstein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have had a look at the WebMap and will point out a few things.&lt;/P&gt;&lt;P&gt;1. In the code below you are accessing a Group Layer with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;income = webmap.get_layer(title="Median Household Income")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You really want to access an individual layer within this group, such as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;income = webmap.get_layer(title="State (Median income)")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. However, if we look at the webmap, the popup for this layer is disabled. When I turned it on the PopUp doesnt display fields it displays a graph (well, 2 graphs that you can use as a carousel). Are you looking to remove the graphs?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_0-1705997733131.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92486iB151D865BED5AF3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1705997733131.png" alt="Clubdebambos_0-1705997733131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can still access the popupInfo for that layer using the following...&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;from arcgis.gis import GIS
from arcgis.mapping import WebMap
import json

gis = GIS()

webmap_item = gis.content.get("efa66839c8804250917dc75b07839fdf")

webmap = WebMap(webmap_item)

income = webmap.get_layer(title="State (Median income)")

print(json.dumps(income["popupInfo"], indent=4))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. never use list as a variable, it is a keyword in Python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;list = ["Percent_with_foodstamps", "Percent_unemployed"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. I have a bug request in against the configure_pop_ups() method (link &lt;A href="https://github.com/Esri/arcgis-python-api/issues/1740" target="_blank" rel="noopener"&gt;here&lt;/A&gt;),that affects its use when the popupElements is set and has its own fieldInfos, this is just something to be aware of when attempting to manipulate popups. It will work but it will make the fields visible or not in the attribute table.&lt;/P&gt;&lt;P&gt;I hope that gets you a step closer to what you want to achieve.&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2024 09:25:16 GMT</pubDate>
    <dc:creator>Clubdebambos</dc:creator>
    <dc:date>2024-01-23T09:25:16Z</dc:date>
    <item>
      <title>How to edit popupInfo properties for 'PropertyMap' type?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1372609#M9555</link>
      <description>&lt;P data-unlink="true"&gt;I am trying to edit the popup fields for a featureset layer (of points) I have added to a WebMap class item. I have been trying to follow the&lt;A href="https://github.com/Esri/arcgis-python-api/blob/conference_talks/talks/DevSummit2022/Managing_Web_Maps_and_Layers_Using_ArcGIS_API_for_Python/Authoring_and_Editing_Webmap.ipynb" target="_self"&gt; sample notebook from DevSummit2022 on editing popups&lt;/A&gt;,&amp;nbsp; &amp;nbsp; but I am stuck at&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;In [23]:&amp;nbsp;national_forest&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;webmap&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;get_layer&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;title&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;SPAN class=""&gt;"national_forest"&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt;
&lt;SPAN class=""&gt;         national_forest&lt;/SPAN&gt;&lt;SPAN class=""&gt;.&lt;/SPAN&gt;&lt;SPAN class=""&gt;popupInfo&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P data-unlink="true"&gt;When I do the same operation on my webmap layer, for 'national_forest' I get an object of type 'arcgis._impl.common._mixins.PropertyMap' and an error that says:&lt;/P&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;PRE&gt;'PropertyMap' instance has no attribute 'popupInfo'&lt;/PRE&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;&lt;DIV class=""&gt;I've tried pulling the definition for the layer, and seeing if popupInfo is one of the keys, but it's not.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;Ideally, I'd love to be able to :&lt;/DIV&gt;&lt;DIV class=""&gt;- filter/select which fields are in the popup (at minimum)&lt;/DIV&gt;&lt;DIV class=""&gt;- include additional text&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;- pull in info for intersecting polygon layers&lt;/DIV&gt;&lt;DIV class=""&gt;The last two would be similar to what I have done in arcade, so I don't know if it's possible with the API.&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;I'm new to the API as well as to posting, so please let me know if I haven't provided enough information and I'd be happy to. Thanks so much!&lt;/DIV&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 19 Jan 2024 23:29:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1372609#M9555</guid>
      <dc:creator>maya_fromstein</dc:creator>
      <dc:date>2024-01-19T23:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit popupInfo properties for 'PropertyMap' type?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1372716#M9559</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/751607"&gt;@maya_fromstein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you post your current code please? I know you have posted a link but it's always better to post you own endeavours when asking a question.&lt;/P&gt;&lt;P&gt;The first two below are easy enough to implement, the third is probably possible by adding an Arcade expression, which you can also do using the API (I use it to add links to Google Street View for example.)&lt;/P&gt;&lt;DIV class=""&gt;- filter/select which fields are in the popup (at minimum)&lt;/DIV&gt;&lt;DIV class=""&gt;- include additional text&amp;nbsp;&lt;/DIV&gt;&lt;DIV class=""&gt;- pull in info for intersecting polygon layers&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 21 Jan 2024 08:25:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1372716#M9559</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-01-21T08:25:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit popupInfo properties for 'PropertyMap' type?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1373132#M9569</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/417766"&gt;@Clubdebambos&lt;/a&gt;&amp;nbsp; ! Thanks so much for helping me understand how to create a more helpful post (I'm new to this).&lt;/P&gt;&lt;P&gt;The eg below is just a webmap I made from publicly available layers in LivingAtlas:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;from arcgis.gis import GIS
from arcgis.mapping import WebMap

gis = GIS()
webmap_item = gis.content.get("efa66839c8804250917dc75b07839fdf")
# convert webmap item into WebMap
webmap = WebMap(webmap_item)

# try to access popupInfo 
income = webmap.get_layer(title="Median Household Income")
income.popupInfo&lt;/LI-CODE&gt;&lt;P&gt;Produces error:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_9236\3513109354.py in &amp;lt;cell line: 0&amp;gt;()
      2 
      3 income = webmap.get_layer(title="Median Household Income")
----&amp;gt; 4 income.popupInfo

~\AppData\Local\miniconda3\envs\test-env\Lib\site-packages\arcgis\_impl\common\_mixins.py in __getattr__(self, key)
     78         """
     79         if key not in self or not self._valid_name(key):
---&amp;gt; 80             raise AttributeError(
     81                 "'{cls}' instance has no attribute '{name}'".format(
     82                     cls=self.__class__.__name__, name=key

AttributeError: 'PropertyMap' instance has no attribute 'popupInfo'&lt;/LI-CODE&gt;&lt;P&gt;However, popupInfo does come up when I search the keys for the operational layer.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;webmap.definition['operationalLayers'][0].keys()
output:
dict_keys(['id', 'opacity', 'disablePopup', 'title', 'url', 'visibility', 'itemId', 'layerType', 'layerDefinition', 'popupInfo'])&lt;/LI-CODE&gt;&lt;P&gt;I thought I would try a workaround since I could find it in the layer's dictionary, which almost worked, but I still got stuck because of the PropertyMap issue.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;inc_popup = income_dict['popupInfo'] # works
fieldinfos = inc_popup['fieldInfos'] # brings up list
fields = []
for field in fieldinfos:
    fields.append(field["fieldName"]) # creates list of all the field names
#lets say want to keep 'percent_with_foodstamps' and 'percent_unemployed'
list = ["Percent_with_foodstamps", "Percent_unemployed"]
for field in list:
    fields.remove(field) # successfully removes these two fields from the list
# set our fields to false visibility
webmap .configure_pop_ups(layer_title=income.title,
                        field_names=fields,
                        visibility=False)&lt;/LI-CODE&gt;&lt;P&gt;Returns this error message:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;AttributeError                            Traceback (most recent call last)
~\AppData\Local\Temp\ipykernel_9236\3973670836.py in &amp;lt;cell line: 0&amp;gt;()
      1 # set our fields to false visibility (aka not visible)
----&amp;gt; 2 webmap.configure_pop_ups(layer_title=income.title,
      3                         field_names=fields,
      4                         visibility=False)

~\AppData\Local\miniconda3\envs\test-env\Lib\site-packages\arcgis\mapping\_types.py in configure_pop_ups(self, layer_title, field_names, visibility)
   2228         for field_name in field_names:
   2229             idx = 0
-&amp;gt; 2230             for field in layer.popupInfo.fieldInfos:
   2231                 if field["fieldName"] == field_name:
   2232                     layer.popupInfo.fieldInfos[idx].visible = visibility

~\AppData\Local\miniconda3\envs\test-env\Lib\site-packages\arcgis\_impl\common\_mixins.py in __getattr__(self, key)
     78         """
     79         if key not in self or not self._valid_name(key):
---&amp;gt; 80             raise AttributeError(
     81                 "'{cls}' instance has no attribute '{name}'".format(
     82                     cls=self.__class__.__name__, name=key

AttributeError: 'PropertyMap' instance has no attribute 'popupInfo'&lt;/LI-CODE&gt;&lt;P&gt;Another curious situation is that that is the only layer of the 3 with 'popupInfo' in the dictionary key, even though I added them all the same way through Living Atlas and they are all PropertyMap types.&lt;/P&gt;&lt;P&gt;If I could get this code to work, I could understand how I could customize which fields are viewable - but a) I can't and b) I still am clueless as to how to add additional text in the popup.&lt;/P&gt;&lt;P&gt;Hope this was more helpful, again please let me know if not. Thanks so much for your help!&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 19:35:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1373132#M9569</guid>
      <dc:creator>maya_fromstein</dc:creator>
      <dc:date>2024-01-22T19:35:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit popupInfo properties for 'PropertyMap' type?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1373351#M9573</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/751607"&gt;@maya_fromstein&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have had a look at the WebMap and will point out a few things.&lt;/P&gt;&lt;P&gt;1. In the code below you are accessing a Group Layer with&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;income = webmap.get_layer(title="Median Household Income")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You really want to access an individual layer within this group, such as below.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;income = webmap.get_layer(title="State (Median income)")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. However, if we look at the webmap, the popup for this layer is disabled. When I turned it on the PopUp doesnt display fields it displays a graph (well, 2 graphs that you can use as a carousel). Are you looking to remove the graphs?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Clubdebambos_0-1705997733131.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/92486iB151D865BED5AF3C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Clubdebambos_0-1705997733131.png" alt="Clubdebambos_0-1705997733131.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can still access the popupInfo for that layer using the following...&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;from arcgis.gis import GIS
from arcgis.mapping import WebMap
import json

gis = GIS()

webmap_item = gis.content.get("efa66839c8804250917dc75b07839fdf")

webmap = WebMap(webmap_item)

income = webmap.get_layer(title="State (Median income)")

print(json.dumps(income["popupInfo"], indent=4))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3. never use list as a variable, it is a keyword in Python.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;list = ["Percent_with_foodstamps", "Percent_unemployed"]&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4. I have a bug request in against the configure_pop_ups() method (link &lt;A href="https://github.com/Esri/arcgis-python-api/issues/1740" target="_blank" rel="noopener"&gt;here&lt;/A&gt;),that affects its use when the popupElements is set and has its own fieldInfos, this is just something to be aware of when attempting to manipulate popups. It will work but it will make the fields visible or not in the attribute table.&lt;/P&gt;&lt;P&gt;I hope that gets you a step closer to what you want to achieve.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 09:25:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1373351#M9573</guid>
      <dc:creator>Clubdebambos</dc:creator>
      <dc:date>2024-01-23T09:25:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit popupInfo properties for 'PropertyMap' type?</title>
      <link>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1374906#M9588</link>
      <description>&lt;P&gt;Hi again.&lt;/P&gt;&lt;P&gt;Thank you so much!&lt;/P&gt;&lt;P&gt;I was trying to customize the pop-ups for one of those layers as an example because I thought the process would be the same. I'm really trying to customize pop-ups for a point layer, but I don't think I can share it publicly.&lt;/P&gt;&lt;P&gt;Pointing out that those feature layers are group layers was INCREDIBLY helpful! I am used to ArcPro, and it took me a bit to adjust to each 'layer' having many sublayers at different scales in arcgis online. I totally forgot when I moved to the api. Thank you! Same with the list variable tip.&lt;/P&gt;&lt;P&gt;Following your instructions finally let me access the popups dict in the points layer though - so I am very grateful. I realized that I could just take the json from popups that were already formatted with arcade the way I wanted, now I am just struggling to successfully apply that to the other layer.&amp;nbsp;&lt;BR /&gt;Thanks for your help!&lt;/P&gt;</description>
      <pubDate>Fri, 26 Jan 2024 17:06:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-api-for-python-questions/how-to-edit-popupinfo-properties-for-propertymap/m-p/1374906#M9588</guid>
      <dc:creator>maya_fromstein</dc:creator>
      <dc:date>2024-01-26T17:06:16Z</dc:date>
    </item>
  </channel>
</rss>

