Select to view content in your preferred language

Always include 'disablePopups' value in layer's JSON configuration response

192
0
04-15-2025 08:42 AM
Status: Open
Labels (2)
MikeLachance1
Regular Contributor

Currently, if you read the configuration JSON for a web map (specifically looking at each layer within it's operational layers) I have noticed that the 'disablePopups' parameter sometimes is not appear in the layer's JSON configuration despite pop-ups being turned on for that layer.

I added a new layer to an existing map. The layer came into the map with pop-ups turned on already. I made edits to the content of the pop-up and saved my map. When I ran my Python Notebook that is reading the JSON from this web map, the new layer's config JSON (stored within the Operational Layers section of the map JSON) did not contain the value 'disablePopups'. However, if I go back into the map, turn the pop-ups for that layer off, on again, and then save my map. The JSON now comes back with the 'disablePopups' value (In this case it is false since pop-ups are enabled).

I am trying to evaluate popup content in a given map using a Python Notebook and the map's config JSON but I am finding that this 'disablePopups' value is not always present for layers that popups are enabled. This work is supporting my organization's efforts to make all our AGOL content accessible in accordance with the ADA Title II requirements coming into effect in April of 2026. Being able to read a layer's configuration programmatically helps me to evaluate a map's level of compliance with the ADA Title II accessibility standards.

 

Below is a sample of the Python function I wrote to report the JSON configuration of a given layer in a web map:

def check_map_json(map_item):
    
    #JSON Data
    all_resources = map_item.resources.list()
    json_data = map_item.get_data(try_json = True)
   
    # Iterate through operational layers
    opLayers = json_data['operationalLayers']
    all_layers = []
    
    for lyr in opLayers:
        if 'layers' in lyr.keys():
            for sublyr in lyr['layers']:
                all_layers.append(sublyr)
            
        else:
            all_layers.append(lyr)
            
    
    for lyr in all_layers:
        lyr_keys = lyr.keys()
        
        # Pop-up Text
        if lyr['layerType'] == 'ArcGISFeatureLayer' and not 'featureCollectionType' in lyr_keys:
            
            if 'disablePopup' in lyr_keys and lyr['disablePopup'] is False:
                popupInfo = lyr['popupInfo']['popupElements'][0]
                print(popupInfo)