---format: html: code-fold: true code-tools: truejupyter: python3---```{python}#| echo: false#| column: screen-inset-shadedfrom ipyleaflet import Map, Marker, Popup, basemaps, basemap_to_tilesfrom ipywidgets import HTML, Layout# Define the map center and zoom levelcenter = (20.0, 0.0)zoom =2# Create the mapm = Map( basemap=basemap_to_tiles(basemaps.OpenStreetMap.Mapnik), center=(48.204793, 350.121558), zoom=2, layout=Layout(width='100%', height='600px'))# List of adventures with coordinates, descriptions, and image URLsadventures = [ {'location': (36.3578, 127.3867),'name': 'Daejeon, South Korea','description': 'Alan was Born in Taejun-city, South Korea','image':'images/story/adoption.png' }, {'location': (44.836667, -108.392222),'name': "Lovell, Wyoming",'description': "Alan's father was raised in a small town in Wyoming. He calls it the best place to grow up", }, {'location': (14.4514, 121.1919),'name': "Rizal, Philippines",'description': "Audrey Mae, Alan's wife, was born in the Philippines. She has fond memories of eating fresh atis (sugar apple), mango, and jackfruit as a child", }, {'location': (30.306944, -97.965278),'name': "Bee Cave, Texas",'description': "Alan spent his teenage years predominantly in the suburbs of Austin. He played percussion and sang in choir during highschool", }, {'location': (35.66205202232861, 139.69877462383164),'name': "Shibuya, Tokyo, Japan",'description': "Alan proposed to Audrey Mae on top of the Parco tower in Shibuya ward in Tokyo, Japan",'image':'images/map/proposal.JPG' }, {'location': (35.68527407125619, 139.72336815212773),'name': "Shinjuku City, Tokyo, Japan",'description': "Staircase to Suga Shrine, popularized from Your Name",'image':'images/map/japan.jpg' }, {'location': (40.760833, -111.891111),'name': "Salt Lake City, Utah",'description': "Alan and Audrey Mae were married in a courthouse in Salt Lake City, Utah", }, {'location': (43.826111, -111.783889),'name': "Rexburg, Idaho",'description': "Alan recieved his Bachelor's of Science in Data Science in this small Christian college",'image':'images/map/grad.jpg' }, {'location': (19.433333, -99.133333),'name': "Mexico City, Mexico",'description': "Alan studied to be a good volunteer for his church in this training center in Mexico City", }, {'location': (39.289444, -76.615278),'name': "Baltimore, Maryland",'description': "Alan embarked for a year in Baltimore Maryland for service for his Church. He served as a technology consultant and further developed his Spanish", }, {'location': (33.352778, -111.788889),'name': "Gilbert, Arizona",'description': "Alan was adopted to the Averett family in Gilbert, Arizona as the fifth child",'image':'images/map/arizona.jpg' }, {'location': (39.92, -83.770833),'name': "Springfield, Ohio",'description': "Before Alan, the Averett family children had all grown up in Springfield, Ohio", }, {'location': (36.85, -75.977778),'name': "Virginia Beach, Virginia",'description': "Alan recieved his Certificate of Citizenship here",'image':'images/map/citizen.jpg' }, {'location': (38.934167, -77.1775),'name': "Booz Allen Hamilton",'description': "Alan's first real full-time job as a data scientist at Booz Allen Hamilton",'image':'images/map/booz.jpg' }, {'location': (45.508889, -73.554167),'name': "Montreal, Canada",'description': "Daytrip in Montreal",'image':'images/map/montreal.jpg' }, {'location': (21.261944, -157.805556),'name': "Diamond Head, O'ahu Island, Hawaii",'description': "New Years Weekend, 2025",'image':'images/map/oahu.jpg' }, {'location': (1.359167, 103.989444),'name': "Changi, Singapore",'description': "Layover in Singapore",'image':'images/map/singapore.jpg' }, {'location': (40.7575, -73.985833),'name': "Manhattan, New York City, New York",'description': "Times Square daytrip",'image':'images/map/timesquare.jpg' },]# Add markers with popups to the mapfor adventure in adventures: marker = Marker(location=adventure['location'], draggable=False) message = HTML()# Use get() to safely access dictionary keys with default values name = adventure.get('name', 'Unknown Location') description = adventure.get('description', 'No description available.') image = adventure.get('image', None)# Construct the HTML content for the popup content =f"<h4>{name}</h4><p>{description}</p>"if image: content +=f"<img src='{image}' width='200px'>" message.value = content popup = Popup(child=message, max_width=300) marker.popup = popup m.add_layer(marker)# Display the mapm```