Dash scattermapbox graph - update layout that is of type dictionary

The layout object for scattermapbox graph is of type dictionary. I need add layer property and cannot use .append as documented here: Scatter Plots on Mapbox | Python | Plotly

Is there a way to update layout dict to add the following code:

"layers": [
                        {
                            "source": json.loads(gdf.geometry.to_json()),
                            "below": "traces",
                            "type": "fill",
                            "color": "purple"
                        }
                     ],

Callback code below:

def update_map(input1, input2, input3):

           data = []

           # Plot properties in Comp Set
           for i, row in df.iterrows():

               lat = row["Lat"]
               lng = row["Long"]

               # Generate Address string
               Address_str = row["Address"] + ' ' + row["City"] + ' ' + row["State"] 

               # Set of Lease Comps
               data.append({

                            "type": "scattermapbox",
                            "lat": [lat],
                            "lon": [lng],
                            "name": "Location",
                            "showlegend": False,
                            "hoverinfo": "text",
                            "mode": "markers",
                            "clickmode": "event+select",
                           
                            "marker": {
                                       "symbol": "circle",
                                       "size": 12,
                                       "opacity": 0.7,
                                       "color": "black"
                                      }
                            }
               )

           
           # Dictionary for marker symbol
           sym_dict = {"abc": "sym1",
                              "xyz": "sym2",
                               "pqr": "sym3"}

           # Property Location
           data.append({
                        "type": "scattermapbox",
                        "lat": [Lat],
                        "lon": [Long],
                        "hovertext": price,
                        "hoverinfo": "text",
                        "mode": "text+markers",
                        "marker": {
                            "symbol": sym_dict[type],
                            "size": 28,
                            "opacity": 0.7,
                            "color": "rgb(128, 128, 128)"
                            }
                        }
            )

        layout = {

                     "autosize": True,
                     "hovermode": "closest",
                     "mapbox": {

                         "accesstoken": MAPBOX_KEY,
                         "bearing": 0,
                         "center": {
                             "lat": layout_lat,
                             "lon": layout_lon
                         },
                         "pitch": 0,
                         "zoom": zoom,
                         "style": "outdoors",

                     },

                     

                     "margin": {
                        "r": 0,
                        "t": 0,
                        "l": 0,
                        "b": 0,
                        "pad": 0
                    }

        }

        return {"data": data, "layout": layout}

Another option would be to draw the GeoJSON using dash-leaflet :slight_smile: