programmieren_wise_24_25/Material/wise_24_25/v8.ipynb
2024-12-13 13:06:49 +01:00

776 lines
34 KiB
Plaintext

{
"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": [
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"&lt;html&gt;\n",
"&lt;head&gt;\n",
" \n",
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
" \n",
" &lt;script&gt;\n",
" L_NO_TOUCH = false;\n",
" L_DISABLE_3D = false;\n",
" &lt;/script&gt;\n",
" \n",
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.0/css/all.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
" \n",
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_a13b829e83c68c3c32513de721380294 {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" .leaflet-container { font-size: 1rem; }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt;\n",
" \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_a13b829e83c68c3c32513de721380294&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt;\n",
" \n",
" \n",
" var map_a13b829e83c68c3c32513de721380294 = L.map(\n",
" &quot;map_a13b829e83c68c3c32513de721380294&quot;,\n",
" {\n",
" center: [52.26415, 10.52642],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 13,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_02355d3480b09e865d3b0170663f84be = L.tileLayer(\n",
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" );\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
"&lt;/script&gt;\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f1b09d27800>"
]
},
"execution_count": 12,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"m = folium.Map(\n",
" location=(52.264150, 10.526420),\n",
" tiles='OpenStreetMap',\n",
" #iles='Stamen Toner',\n",
" zoom_start=13,\n",
" prefer_canvas=False\n",
" )\n",
"\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 13,
"id": "2b08e2f2-cf81-439b-b47f-733e123d72d3",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"&lt;html&gt;\n",
"&lt;head&gt;\n",
" \n",
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
" \n",
" &lt;script&gt;\n",
" L_NO_TOUCH = false;\n",
" L_DISABLE_3D = false;\n",
" &lt;/script&gt;\n",
" \n",
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.0/css/all.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
" \n",
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_a13b829e83c68c3c32513de721380294 {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" .leaflet-container { font-size: 1rem; }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt;\n",
" \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_a13b829e83c68c3c32513de721380294&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt;\n",
" \n",
" \n",
" var map_a13b829e83c68c3c32513de721380294 = L.map(\n",
" &quot;map_a13b829e83c68c3c32513de721380294&quot;,\n",
" {\n",
" center: [52.26415, 10.52642],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 13,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_02355d3480b09e865d3b0170663f84be = L.tileLayer(\n",
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" );\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_bb3c68b9bebcd1b6a40283e5539c4a65 = L.marker(\n",
" [52.25802230834961, 10.503097534179688],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
"&lt;/script&gt;\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f1b09d27800>"
]
},
"execution_count": 13,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"my_marker = folium.Marker(\n",
" location=(52.25802230834961, 10.503097534179688)\n",
" )\n",
"\n",
"my_marker.add_to(m)\n",
"\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 14,
"id": "71dbf9b1-2217-40d5-bfa1-c38b2bbc6362",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [
{
"data": {
"text/html": [
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"&lt;html&gt;\n",
"&lt;head&gt;\n",
" \n",
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
" \n",
" &lt;script&gt;\n",
" L_NO_TOUCH = false;\n",
" L_DISABLE_3D = false;\n",
" &lt;/script&gt;\n",
" \n",
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.0/css/all.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
" \n",
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_a13b829e83c68c3c32513de721380294 {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" .leaflet-container { font-size: 1rem; }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt;\n",
" \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_a13b829e83c68c3c32513de721380294&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt;\n",
" \n",
" \n",
" var map_a13b829e83c68c3c32513de721380294 = L.map(\n",
" &quot;map_a13b829e83c68c3c32513de721380294&quot;,\n",
" {\n",
" center: [52.26415, 10.52642],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 13,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_02355d3480b09e865d3b0170663f84be = L.tileLayer(\n",
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" );\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_bb3c68b9bebcd1b6a40283e5539c4a65 = L.marker(\n",
" [52.25802230834961, 10.503097534179688],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_000f18e3236d0891346fe69072792733 = L.marker(\n",
" [52.2643, 10.529],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var popup_5b808f3e85452abf52b15eb63a9ae438 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
"\n",
" \n",
" \n",
" var html_88b86a507c4a59c87877cd9741f3d564 = $(`&lt;div id=&quot;html_88b86a507c4a59c87877cd9741f3d564&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Ritterbrunnen 1, 38100 Braunschweig&lt;/div&gt;`)[0];\n",
" popup_5b808f3e85452abf52b15eb63a9ae438.setContent(html_88b86a507c4a59c87877cd9741f3d564);\n",
" \n",
" \n",
"\n",
" marker_000f18e3236d0891346fe69072792733.bindPopup(popup_5b808f3e85452abf52b15eb63a9ae438)\n",
" ;\n",
"\n",
" \n",
" \n",
" \n",
" marker_000f18e3236d0891346fe69072792733.bindTooltip(\n",
" `&lt;div&gt;\n",
" More about the castle\n",
" &lt;/div&gt;`,\n",
" {&quot;sticky&quot;: true}\n",
" );\n",
" \n",
"&lt;/script&gt;\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f1b09d27800>"
]
},
"execution_count": 14,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"castle_popup = \"Ritterbrunnen 1, 38100 Braunschweig\"\n",
"castle_tooltip = \"More about the castle\"\n",
"\n",
"\n",
"castle_marker = folium.Marker(\n",
" location=(52.2643, 10.529),\n",
" popup=castle_popup,\n",
" tooltip=castle_tooltip\n",
" )\n",
"castle_marker.add_to(m)\n",
"\n",
"m"
]
},
{
"cell_type": "code",
"execution_count": 15,
"id": "60c6bc4b-c339-4cd5-806d-66c879807b6e",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"outputs": [],
"source": [
"hbk_popup_html = folium.Popup(\n",
" '''\n",
" <p>\n",
" <img \n",
" src=\"https://www.hbk-bs.de/fileadmin/_processed_/5/1/csm_HBK_Logo_9f3f898a2b.png\"\n",
" alt=\"HBK BS Logo\">\n",
" </p>\n",
" <p><strong>Johannes-Selenka-Platz 1</strong></p>\n",
" <p><em>38118 Braunschweig</em></p>\n",
" <p><small>Germany, DE</small></p>\n",
" <p>Visit: <a href=\"https://www.hbk-bs.de/\">hbk-bs.de</a> </p>\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": [
"<div style=\"width:100%;\"><div style=\"position:relative;width:100%;height:0;padding-bottom:60%;\"><span style=\"color:#565656\">Make this Notebook Trusted to load map: File -> Trust Notebook</span><iframe srcdoc=\"&lt;!DOCTYPE html&gt;\n",
"&lt;html&gt;\n",
"&lt;head&gt;\n",
" \n",
" &lt;meta http-equiv=&quot;content-type&quot; content=&quot;text/html; charset=UTF-8&quot; /&gt;\n",
" \n",
" &lt;script&gt;\n",
" L_NO_TOUCH = false;\n",
" L_DISABLE_3D = false;\n",
" &lt;/script&gt;\n",
" \n",
" &lt;style&gt;html, body {width: 100%;height: 100%;margin: 0;padding: 0;}&lt;/style&gt;\n",
" &lt;style&gt;#map {position:absolute;top:0;bottom:0;right:0;left:0;}&lt;/style&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-3.7.1.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.js&quot;&gt;&lt;/script&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/leaflet@1.9.3/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap-glyphicons.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.2.0/css/all.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/Leaflet.awesome-markers/2.0.2/leaflet.awesome-markers.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdn.jsdelivr.net/gh/python-visualization/folium/folium/templates/leaflet.awesome.rotate.min.css&quot;/&gt;\n",
" \n",
" &lt;meta name=&quot;viewport&quot; content=&quot;width=device-width,\n",
" initial-scale=1.0, maximum-scale=1.0, user-scalable=no&quot; /&gt;\n",
" &lt;style&gt;\n",
" #map_a13b829e83c68c3c32513de721380294 {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" .leaflet-container { font-size: 1rem; }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt;\n",
" \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_a13b829e83c68c3c32513de721380294&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt;\n",
" \n",
" \n",
" var map_a13b829e83c68c3c32513de721380294 = L.map(\n",
" &quot;map_a13b829e83c68c3c32513de721380294&quot;,\n",
" {\n",
" center: [52.26415, 10.52642],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 13,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_02355d3480b09e865d3b0170663f84be = L.tileLayer(\n",
" &quot;https://tile.openstreetmap.org/{z}/{x}/{y}.png&quot;,\n",
" {&quot;attribution&quot;: &quot;\\u0026copy; \\u003ca href=\\&quot;https://www.openstreetmap.org/copyright\\&quot;\\u003eOpenStreetMap\\u003c/a\\u003e contributors&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 19, &quot;maxZoom&quot;: 19, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" );\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_bb3c68b9bebcd1b6a40283e5539c4a65 = L.marker(\n",
" [52.25802230834961, 10.503097534179688],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_000f18e3236d0891346fe69072792733 = L.marker(\n",
" [52.2643, 10.529],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var popup_5b808f3e85452abf52b15eb63a9ae438 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
"\n",
" \n",
" \n",
" var html_88b86a507c4a59c87877cd9741f3d564 = $(`&lt;div id=&quot;html_88b86a507c4a59c87877cd9741f3d564&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Ritterbrunnen 1, 38100 Braunschweig&lt;/div&gt;`)[0];\n",
" popup_5b808f3e85452abf52b15eb63a9ae438.setContent(html_88b86a507c4a59c87877cd9741f3d564);\n",
" \n",
" \n",
"\n",
" marker_000f18e3236d0891346fe69072792733.bindPopup(popup_5b808f3e85452abf52b15eb63a9ae438)\n",
" ;\n",
"\n",
" \n",
" \n",
" \n",
" marker_000f18e3236d0891346fe69072792733.bindTooltip(\n",
" `&lt;div&gt;\n",
" More about the castle\n",
" &lt;/div&gt;`,\n",
" {&quot;sticky&quot;: true}\n",
" );\n",
" \n",
" \n",
" tile_layer_02355d3480b09e865d3b0170663f84be.addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var marker_a8b222361d202932809a9a63aa4dc6c1 = L.marker(\n",
" [52.25777, 10.50249],\n",
" {}\n",
" ).addTo(map_a13b829e83c68c3c32513de721380294);\n",
" \n",
" \n",
" var icon_9de6d38942261270b6653d55d0af4ff4 = L.AwesomeMarkers.icon(\n",
" {&quot;extraClasses&quot;: &quot;fa-rotate-0&quot;, &quot;icon&quot;: &quot;glyphicon-home&quot;, &quot;iconColor&quot;: &quot;#deddda&quot;, &quot;markerColor&quot;: &quot;black&quot;, &quot;prefix&quot;: &quot;glyphicon&quot;}\n",
" );\n",
" marker_a8b222361d202932809a9a63aa4dc6c1.setIcon(icon_9de6d38942261270b6653d55d0af4ff4);\n",
" \n",
" \n",
" var popup_734be6037b9474a701add342210fde1a = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
"\n",
" \n",
" \n",
" var html_40eb75648f537056aa40a352e1de522e = $(`&lt;div id=&quot;html_40eb75648f537056aa40a352e1de522e&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt; &lt;p&gt; &lt;img src=&quot;https://www.hbk-bs.de/fileadmin/_processed_/5/1/csm_HBK_Logo_9f3f898a2b.png&quot; alt=&quot;HBK BS Logo&quot;&gt; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;Johannes-Selenka-Platz 1&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;38118 Braunschweig&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;small&gt;Germany, DE&lt;/small&gt;&lt;/p&gt; &lt;p&gt;Visit: &lt;a href=&quot;https://www.hbk-bs.de/&quot;&gt;hbk-bs.de&lt;/a&gt; &lt;/p&gt; &lt;/div&gt;`)[0];\n",
" popup_734be6037b9474a701add342210fde1a.setContent(html_40eb75648f537056aa40a352e1de522e);\n",
" \n",
" \n",
"\n",
" marker_a8b222361d202932809a9a63aa4dc6c1.bindPopup(popup_734be6037b9474a701add342210fde1a)\n",
" ;\n",
"\n",
" \n",
" \n",
" \n",
" marker_a8b222361d202932809a9a63aa4dc6c1.bindTooltip(\n",
" `&lt;div&gt;\n",
" More about the university\n",
" &lt;/div&gt;`,\n",
" {&quot;sticky&quot;: true}\n",
" );\n",
" \n",
"&lt;/script&gt;\n",
"&lt;/html&gt;\" style=\"position:absolute;width:100%;height:100%;left:0;top:0;border:none !important;\" allowfullscreen webkitallowfullscreen mozallowfullscreen></iframe></div></div>"
],
"text/plain": [
"<folium.folium.Map at 0x7f1b09d27800>"
]
},
"execution_count": 17,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"hbk_marker = folium.Marker(\n",
" location=(52.257770, 10.502490),\n",
" popup=hbk_popup_html,\n",
" tooltip=hbk_tooltip,\n",
" icon=hbk_icon\n",
" )\n",
"\n",
"hbk_marker.add_to(m)\n",
"\n",
"m"
]
},
{
"cell_type": "markdown",
"id": "78002786-20fb-4b92-be9a-b92b678f50ff",
"metadata": {
"editable": true,
"slideshow": {
"slide_type": ""
},
"tags": []
},
"source": [
"<p>\n",
" <img \n",
" src=\"https://www.hbk-bs.de/fileadmin/_processed_/5/1/csm_HBK_Logo_9f3f898a2b.png\"\n",
" alt=\"HBK BS Logo\">\n",
" <p><strong>Johannes-Selenka-Platz 1</strong></p>\n",
" <p><em>38118 Braunschweig</em></p>\n",
" <p><small>Germany, DE</small></p>\n",
" <p>Visit: <a href=\"https://www.hbk-bs.de/\">hbk-bs.de</a>\n",
"</p>"
]
},
{
"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",
" <p><img src=\"{}\" width=\"300px\" height=\"auto\"></p>\n",
" <p><strong>{}</strong></p>\n",
" <p><em>{}</em></p>\n",
" <p><small>{}</small></p>\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
}