From 0e8bf5f848c1dfe9585b9fb0de2d061781453302 Mon Sep 17 00:00:00 2001 From: Nick Muoh Date: Mon, 13 Apr 2026 14:53:10 +0000 Subject: [PATCH 1/2] Add reset zoom button to interactive map - Implement custom HTML/JS control for resetting map view - Button positioned top-right, styled to match dark theme - Resets map to initial center [20, 0] and zoom level 2 - Includes hover effects for better UX --- scripts/map.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/scripts/map.py b/scripts/map.py index 4bc704b7..35816332 100644 --- a/scripts/map.py +++ b/scripts/map.py @@ -183,8 +183,44 @@ def render(value): popup=folium.GeoJsonPopup(fields=["popup_html"], labels=False, parse_html=True), ).add_to(m) + # Add reset zoom button + reset_zoom_html = """ +
+ + """ + + m.get_root().html.add_child(folium.Element(reset_zoom_html)) + # Save map_path = "assets/map.html" m.save(map_path) logging.info(f"Map saved as {map_path}") + + +if __name__ == "__main__": + logging.basicConfig(level=logging.INFO) + generate_map() From 6a9d9ab0fa93c4b2c486bdcf109b928ffb002548 Mon Sep 17 00:00:00 2001 From: Nick Muoh Date: Fri, 17 Apr 2026 18:00:51 -0700 Subject: [PATCH 2/2] Fix interactive map reset zoom button Replace non-functional reset button with proper Leaflet control Previously, the reset button was broken (accessing non-existent properties) and mispositioned. Now implemented as an L.Control with proper positioning below zoom controls, consistent Leaflet styling, and working click handler. Uses IIFE initialization with retry logic to ensure control loads correctly. --- scripts/map.py | 110 +++++++++++++++++++++++++++++++++++++------------ 1 file changed, 84 insertions(+), 26 deletions(-) diff --git a/scripts/map.py b/scripts/map.py index 35816332..ee472f14 100644 --- a/scripts/map.py +++ b/scripts/map.py @@ -183,36 +183,94 @@ def render(value): popup=folium.GeoJsonPopup(fields=["popup_html"], labels=False, parse_html=True), ).add_to(m) - # Add reset zoom button - reset_zoom_html = """ -
+ # Add reset zoom control using a direct approach + # This script will be added at the end and executed immediately + reset_control_script = folium.Element(""" - """ + """) - m.get_root().html.add_child(folium.Element(reset_zoom_html)) + m.get_root().html.add_child(reset_control_script) # Save map_path = "assets/map.html"