{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "737a2a07-5247-42d5-b06a-ff6a3bf21306", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "import folium" ] }, { "cell_type": "markdown", "id": "dc86d298-4a92-41e2-8e9a-bcb2dd36d80f", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "source": [ "[LatLon](https://www.latlong.net/)" ] }, { "cell_type": "code", "execution_count": 12, "id": "dbed7e42-d95e-4b25-91b8-248cd95f22ea", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "
\n", " \n", "
\n", "Johannes-Selenka-Platz 1
\n", "38118 Braunschweig
\n", "Germany, DE
\n", "Visit: hbk-bs.de
\n", " ''',\n", " show=False\n", " )\n", "\n", "hbk_tooltip = \"More about the university\"" ] }, { "cell_type": "code", "execution_count": 16, "id": "19123dd9-c88d-4713-ab84-4cc692e3f663", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "hbk_icon = folium.Icon(\n", " color='black',\n", " icon_color='#deddda',\n", " prefix='glyphicon',\n", " icon='glyphicon-home',\n", " angle=0\n", " )" ] }, { "cell_type": "code", "execution_count": 17, "id": "7f496828-e49a-4253-98e3-aaa59d0cdc1c", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [ { "data": { "text/html": [ "\n", " \n", "
Johannes-Selenka-Platz 1
\n", "38118 Braunschweig
\n", "Germany, DE
\n", "Visit: hbk-bs.de\n", "
" ] }, { "cell_type": "code", "execution_count": 18, "id": "0547528b-b97f-4e94-aab4-d1d069be020c", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "def popup_factory(adr: str, zipc: str, country: str, pic: str):\n", " html = '''\n", " \n", "{}
\n", "{}
\n", "{}
\n", " '''.format(pic, adr, zipc, country)\n", " return folium.Popup(html)" ] }, { "cell_type": "code", "execution_count": 19, "id": "2ec42850-9c12-4fb4-8b94-024bca9ad9b1", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "def icon_factory(is_public=True):\n", " icon = folium.Icon(\n", " color='black' if is_public else 'white',\n", " icon_color = 'white' if is_public else 'black',\n", " icon='glyphicon-home'\n", " )\n", " return icon" ] }, { "cell_type": "code", "execution_count": 20, "id": "b3d3d3c8-0039-4f80-9f08-5de61172b588", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [ "def marker_factory(loc, popup, is_public=True):\n", " std_tooltip = 'Click for more information'\n", " std_icon = icon_factory(is_public)\n", " return folium.Marker(loc, popup=popup, icon=std_icon, tooltip=std_tooltip)" ] }, { "cell_type": "code", "execution_count": null, "id": "18701dc2-4409-486d-ad7d-7bde6fc3273e", "metadata": { "editable": true, "slideshow": { "slide_type": "" }, "tags": [] }, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.7" } }, "nbformat": 4, "nbformat_minor": 5 }