Configure Popup Attributes Programmatically with ArcGIS API for Python

13204
20
Jump to solution
03-19-2018 04:58 PM
NathanielEvatt
New Contributor III

I am hoping to run a script that can hide certain fields from an ArcGIS Online web map.  In ArcGIS Online, I would accomplish this by opening a webmap, clicking the three dots of the layer I was interested in, selecting "configure pop-up" then selecting "Configure Attribute".  Finally from there I can edit the display options in the GUI shown below.  

Is this something that is currently configurable from the ArcGIS API for Python?

20 Replies
Sean-Sweeney
New Contributor II

I still haven't gotten around to trying @AlderMaps' solution. It's been sitting there on my to-do list mocking me, for almost a year now I see. 

by Anonymous User
Not applicable

You can accomplish this by editing the visibility property of each field. You can do something like this

web_map_obj = WebMap(wm_item)
layer_1 = web_map_obj.layers[0]

#turn off visibility of field 1 of layer 1
layer_1.popupInfo.fieldInfos[0].visible = False

# update the web map
web_map_obj.update()
by Anonymous User
Not applicable

This is great. Thank you. Where is this documented? This is the first I've seen of this particular functionality.

Thanks,

Randy

0 Kudos
by Anonymous User
Not applicable

When the I have an operational layer that is a map service layer, the "layers" property for that consistently misses many layers. I have one service that has 24 layers, and only 3 are returned. I thought maybe only the visible layers were being returned, or just the group layers, but neither is the case. Just 3 random layers are returned, all the rest totally ignored.

 

MapImageLayer will list all layers, but that is just the contents of the portal item associated with the map service, rather than the configured layer within the web map, which is what I wan't to get at.

Is there something I'm missing (probably)?

Thank you,

Randy

0 Kudos
NathanielEvatt
New Contributor III

Cool, thanks very much guys

0 Kudos
MaximeCampeau
New Contributor II

Regarding this question, does anybody know if it is possible via Python to change the order in which the pop-ups appear in the menu? You can do it via the Web Interface, but I haven't found a way to do so with Python. Anyone has ever tried?

EarlMedina
Esri Regular Contributor

Hi Renaud,

This boils down to how the item is defined. For a good idea, see the second note in this post: https://community.esri.com/groups/arcgis-python-api/blog/2019/04/09/updating-layer-symbology-with-th.... My advice would be to create a Web Map as you want it to appear and then look at the definition.

-Earl

JulieK
by
Occasional Contributor

Thanks for the blog, this might help me do what I want. 

Using Python API, I am creating a webmap and adding a view to it. The view has three layers, and I want to configure the sequence of fields in each layer using json files.

I have created 3  json files based on all layer files in the webmap. can I update properties from json file as mentioned in your blog? 

In your blog , in the first section 'update layer symbology in a webmap', in Line 5, are you searching for a layer in a webmap? it seems to list out feature services with the same name as the layer name in the web map. Please help!!.

0 Kudos
JulieK
by
Occasional Contributor

Thanks Earl, I was able to update the properties. 'layer_name' variable in line 5 threw me off. Searched for web map name and that worked!!


					
				
			
			
				
			
			
				
			
			
			
			
			
			
		
0 Kudos
achapapkowski
New Contributor II

Just a heads up for saved webmaps, you are going to be able to do this easier in ArcGIS API for Python v2.0.1.