Previous project people developed the app on Python shiny. Project partners requested the map does not revert back to its original center and zoom when adding visualization layers, so I was hoping to see if there’s a way in ipyleaflet to use event handlers to track the UI activity and then reflect that information in the map. Any ideas?
` last_center = [44.44343571548758,-84.36155640717737]
last_zoom = 6
@output
@render_widget
def map():
basemap = basemaps[input.basemap()]
layerlist = input.layers()
the_map = L.Map(basemap=basemap,
center= last_center,
zoom= last_zoom, layout=Layout(width="100%", height="100%"))
markerorcircle = False
if "Marker (name, address, # sites, source)" in layerlist:
build_marker_layer(LARA_C = 0)
marker_cluster = L.MarkerCluster(
name='location markers',
markers=tuple(mklist_mh)
)
the_map.add_layer(marker_cluster)
markerorcircle = True
if "Marker LARA (name, address, # sites, source)" in layerlist:
build_marker_layer(LARA_C = 1)
marker_cluster = L.MarkerCluster(
name='location markers',
markers=tuple(mklist_lara)
)
the_map.add_layer(marker_cluster)
markerorcircle = True
if "Legislative districts (Michigan State Senate)" in layerlist:
build_district_layers(upper = 1)
the_map.add_layer(upper_layers[0])
if "Legislative districts (Michigan State House of Representatives)" in layerlist:
build_district_layers(upper = 0)
the_map.add_layer(lower_layers[0])
return the_map`
I have no idea at all how to do this. And have no clue where to find more since the documentation seems to suggest you CAN’T do this.