Delete a marker from map

Continuing the discussion from Show and Tell - Dash Leaflet:

Is there any function to delete a marker from map?

A Marker is like any other component in Dash; you can update it via a callback. Here is an example,

import dash
import dash_html_components as html
import dash_leaflet as dl

from dash.dependencies import Input, Output

# Create example app.
app = dash.Dash(prevent_initial_callbacks=True)
app.layout = html.Div([
    dl.Map([dl.TileLayer(), dl.LayerGroup(id="container", children=[dl.Marker(position=(56,10))])],
           center=(56, 10), zoom=5, style={'width': '100%', 'height': '50vh', 'margin': "auto", "display": "block"}),
    html.Button("Remove markers", id="btn")
])


@app.callback(Output("container", "children"), [Input("btn", "n_clicks")])
def remove_markers(n_clicks):
    return []


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

@Emil Thank You for your help.