Hi All,
I want to interact (hover, click) with Polygons coming from an MVT source. I have successfully imported the mvt source within “mapbox_layers” parameter of figure.Layout. Unfortunately, when I hover on polygons of this source, there is no interactivity at all.
Here is my code and the result it produces :
fig = px.scatter_mapbox(lat=[50.5039], lon=[4.46990])
fig.update_layout(
mapbox = dict(center=go.layout.mapbox.Center(lat=50.5039,lon=4.46990), zoom=17),
mapbox_style="white-bg",
activeshape = {'fillcolor' :"aqua"},
mapbox_layers=[
{
"below": 'traces',
"sourcetype": "vector",
"source": [
"http://xx.xxx.224.27:3000/v1/mvt/parcel/{z}/{x}/{y}?fields=id,id_original"
],
"type" : "fill",
"color" : "#3366ff",
"opacity" : 1,
"sourcelayer":"parcel"
},
{
"below": 'traces',
"sourcetype": "vector",
"source": [
"http://xx.xxx.224.27:3000/v1/mvt/building/{z}/{x}/{y}?fields=id,id_original"
],
"type" : "fill",
"color" : "#f06f06",
"opacity" : 1,
"sourcelayer":"building"
}
])
Ultimately, I would like to display attributes of the polygon on the map and within a Dash Application.
- I was able to load this layer as GeoJSON and interact with it but it was slow to load. Much slower than having our server returning MVT.
- I was able to load this MVT using mapboxgl into a very basic html page. And it is interactive…
Can Mapbox Plotly.py graphs interact with MVT layers (Click and Hover behaviour) ?