Closed jajberni closed 1 month ago
Hey @jajberni, the documentation is a bit obscure on how to change the layers prop but you should be able to use params
to do it:
# Callback to update the selected layer in WMSTileLayer
@callback(
Output('wms_map', 'params'),
Input('layerId', 'value'),
State('wms_map', 'params'),
#prevent_initial_call=True
)
def changeLayer(selected_layer, current_layer):
print("new: ", selected_layer)
print("current: ", current_layer)
return dict(layers=selected_layer)
Thank you @prl900! You are completely right. Using the params
instead of the property worked perfectly. It would be good to fix the documentation as it's very confusing now.
Closing the issue.
I've been trying to implement a simple dash script where a select control will change the displayed layer in a WMSTileLayer. However, changing layers or styles in the callback doesn't seem to have any effect.
Here is a sample code of my attemp. This code only changes the
layers
property for sample puporses, but the same behaviour is observed when trying to changestyles
.