# Map updated by dropdown - First callback working but not second one - close to give up :(

**URL:** <https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148>\
**Category:** Dash Python\
**Created:** [April 3, 2020, 8:36am UTC](https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148 "2020-04-03T08:36:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![flohaha](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/flohaha/32/10086_2.png) [@flohaha](https://community.plotly.com/u/flohaha)\
**Post date:** [April 3, 2020, 8:36am UTC](https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148/1 "2020-04-03T08:36:15Z")

</div>

Hi,

Just starting with Dash and loving it… until I tried to have a filter to update a map (MapBox). The first callback generating the map works well, map is displayed. When I select on filter, the callback seems to run (I get the updated print(len(dff)), but the Map doesn’t get updated. On the other side my table is updated correctly by the filter

Did my research and suspect a version issue but I tried to downgrade and it didn’t change ( [https://github.com/plotly/dash/issues/223](https://github.com/plotly/dash/issues/223) )

I’m dying for help here!!! 😉

Flo

Here is my code and versions:

**1) Requirements**

```auto
dash==1.10.0
dash-core-components==1.9.0
dash-html-components==1.0.3
dash-renderer==1.3.0
dash-table==4.6.2
dash-table-experiments==0.6.0

```

**2) Map Function**

```auto
def gen_map(df):
    return {
        "data": [{
                "type": "scattermapbox",
                "lat": list(df['Latitude']),
                "lon": list(df['Longitude']),
                "hoverinfo": "text",
                "hovertext": [["Name: {} <br>Type: {} <br>Provider: {}".format(i,j,k)]
                                for i,j,k in zip(df['Nom'], df['Livraison'],df['Commune'])],
                "mode": "markers",
                "name": list(df['Nom']),
                "marker": {
                    "size": 6,
                    "opacity": 0.7
                }
        }],
        "layout": layout_map
    }

```

**3) Map Layout:**

```auto
layout_map = dict(
    autosize=True,
    height=500,
    font=dict(color="#191A1A"),
    titlefont=dict(color="#191A1A", size='14'),
    margin=dict(
        l=35,
        r=35,
        b=35,
        t=45
    ),
    hovermode="closest",
    plot_bgcolor='#fffcfc',
    paper_bgcolor='#fffcfc',
    legend=dict(font=dict(size=10), orientation='h'),
    #title='WiFi Hotspots in NYC',
    mapbox=dict(
        accesstoken=MAPBOX_API_TOKEN,
        #style="light",
        center=dict(
            lat=df['Latitude'].mean(),
            lon=df['Longitude'].mean()
        ),
        zoom=10,
    )
)

```

**4) Dash Component**

```auto
html.Div(
        [
            dcc.Graph(id='map-graph',
                      animate=True,
                      style={'margin-top': '20'})
        ] #, className="six columns"
    ),

```

**5) Map Callback**

```auto
def map_selection(city , delivery):
    if type(city) is list and city and type(delivery) and delivery:
        dff = df[(df['Commune'].isin(city)) & (df['Livraison'].isin(delivery))]
    elif type(city) is list and city:
        dff = dff = df[(df['Commune'].isin(city))]
    elif type(delivery) is list and delivery:
        dff = dff = df[(df['Livraison'].isin(delivery))]
    else:
        dff = df
    print(len(dff))
    print('generate map')
    return gen_map(dff)

```

---

<div class="post-metadata">

**Author:** ![Emmanuelle](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/emmanuelle/32/7853_2.png) [@Emmanuelle](https://community.plotly.com/u/Emmanuelle)\
**Post date:** [April 3, 2020, 2:45pm UTC](https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148/2 "2020-04-03T14:45:49Z")

</div>

Hi @flohaha regarding possible version conflicts, you can try to uninstall all the above packages and install only `dash` again, which will install compatible versions of all other packages (`dcc`, `html`, `dash-table` etc.) Incompatible versions of `dash` and `dcc` have been a frequent source of empty plots like yours in the past so let’s keep fingers crossed that this is the issue.

---

<div class="post-metadata">

**Author:** ![nicholasatward](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@nicholasatward](https://community.plotly.com/u/nicholasatward)\
**Post date:** [March 6, 2023, 7:56am UTC](https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148/3 "2023-03-06T07:56:03Z")

</div>

Not sure if this was ever resolved but I am experiencing the same issue with the latest versions of plotly and dash!

---

<div class="post-metadata">

**Author:** ![jinnyzor](https://sea2.discourse-cdn.com/flex024/user_avatar/community.plotly.com/jinnyzor/32/21194_2.png) [@jinnyzor](https://community.plotly.com/u/jinnyzor)\
**Post date:** [March 6, 2023, 12:41pm UTC](https://community.plotly.com/t/map-updated-by-dropdown-first-callback-working-but-not-second-one-close-to-give-up/37148/4 "2023-03-06T12:41:32Z")

</div>

Hello @nicholasatward,

Welcome to the community!

Could you please post some code to allow us to see what may be going on?

> [@How to write a Minimal Reproducible Example (MRE)](https://community.plotly.com/t/how-to-write-a-minimal-reproducible-example-mre/61502):
>
> Adding a minimal reproducible example to your questions will help attract community members to answer your question. The goal of writing a MRE is to allow other members of the community to run the code on their computers and “reproduce” the error, so that they can best help you. Please make sure that your MRE includes data and that the code is correctly pre-formatted. To preformat, copy and paste the code in your post and then click on \</\> (Preformatted text), as shown on the image:
