Как получить данные (geo json properties - name, id et c) из события щелчка многоугольника mapboxgl в python dash / plotly?
Ниже Da sh График элемент
layer = dict(
type="fill",
below='traces',
color="#18607e",
opacity=0.7,
hovermode="closest",
interactive=True,
text=[x['properties']['id'] for x in geojson['features']],
source=geojson,
sourcetype="geojson"
)
element = dcc.Graph(
id='TxWCD-choropleth',
figure=dict(
data=[dict(
type='scattermapbox'
)],
layout=dict(
plot_bgcolor="#18607e",
paper_bgcolor="#18607e",
clickmode="event+select",
mapbox=dict(
layers=[layer],
accesstoken=_token,
center=dict(
lat=53.350140,
lon=-6.266155
),
zoom=1,
style='light'
),
height=600,
autosize=True,
margin=dict(
l=0,
r=0,
b=0,
t=0,
pad=4
)
)
)
)
Событие обратного вызова:
app.callback(
Output(component_id='graphs', component_property='children'),
[Input('map-flex', "n_clicks")]
)
def update_graph(data):
# Do some updates
# Expected result: mapbox click event data geojson properties
return ''
Ожидаемый результат:
При щелчке полигона Mapbox возвращаются данные события Mapbox. т. е. geo json properties.
Любая помощь или обходной путь приветствуется. Спасибо