Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

Choroplethmapbox is not displayed with geojson data

$
0
0

@Maeaex1 wrote:

Hi,

I am trying to create a map of Lisbon, Portugal with Geojson and colour the districts with the corresponding value. However, the chart does not return anything but doesn’t show an error at the same time.

If you like to reproduce my problem you can find the data + code in this dropbox folder.

Maybe my mistake is also obvious so find below my used code:

app.layout = html.Div([
    dcc.Graph(id='graph')
])

@app.callback(
    Output('graph', 'figure')
)

def update_graph():
    global data

    fig = [go.Choroplethmapbox(
        geojson=districts, locations=data.district, z=data.price,
        featureidkey="properties.NOME", colorscale="Viridis", zmin=data.price.min(), zmax=data.price.max(),
        marker_opacity=0.5, marker_line_width=0)]

    layout = go.Layout(mapbox_style="carto-positron",
                      mapbox_zoom=3, mapbox_center={"lat": 38.7436057, "lon": -9.2302432},
                       )


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

if __name__ == '__main__':
    app.run_server(debug=True)

Thanks for your help!

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 6271

Latest Images

Trending Articles



Latest Images