I have a dash app with a map of country made in Python. Currently, it can zoom out to continent view and even world view. I want to restrict the zoom so that user cannot zoom out beyond the country view. Then can zoom in, however, as much as they want. How do I do this?
I found that the Mapbox GL JS library gives options to control the max and min zoom via options.minZoom
and options.maxZoom
. Is there any way to use these, or something similar, with Python?
I tried using these 2 parameters like so:
go.Scattermapbox(
lat=df.Lat,
lon=df.Lon,
mode='markers',
marker=go.scattermapbox.Marker(
size=10,
opacity=0.5,
color=COLORS
),
maxZoom=20,
minZoom=5
)
but it seems these 2 properties have not been implemented in the Plotly/Dash version of Mapbox:
ValueError: Invalid property specified for object of type plotly.graph_objs.Scattermapbox: 'maxZoom'