Skip to content

Instantly share code, notes, and snippets.

@vladimir-rybalko
Last active November 1, 2022 17:35
Show Gist options
  • Save vladimir-rybalko/65087047f1bebab63ce76fd8573a9842 to your computer and use it in GitHub Desktop.
Save vladimir-rybalko/65087047f1bebab63ce76fd8573a9842 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"id": "26e21ff6",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting foliumNote: you may need to restart the kernel to use updated packages.\n",
"\n",
" Using cached folium-0.13.0-py2.py3-none-any.whl (96 kB)\n"
]
}
],
"source": [
"%pip install folium"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "f52580ec",
"metadata": {},
"outputs": [],
"source": [
"import folium\n",
"from folium.plugins import MousePosition"
]
},
{
"cell_type": "code",
"execution_count": 23,
"id": "e658cc23",
"metadata": {},
"outputs": [],
"source": [
"map = folium.Map(\n",
" location = [56.839234, 60.546997], # широта и долгота Екб\n",
" zoom_start = 12,\n",
" tiles='https://geoapi.ift.datacloud.t1-cloud.ru/tiller/tile/{z}/{x}/{y}.png?apikey=b019d06a-5de8-41d4-be11-c9778bcb916e',\n",
" attr='INNOTECH'\n",
")"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "139afd8d",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<folium.map.Marker at 0x16bed5a62b0>"
]
},
"execution_count": 24,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"featureGroup = folium.map.FeatureGroup()\n",
"\n",
"featureGroup.add_child(\n",
" folium.features.CircleMarker([56.839234, 60.546997], radius = 5, color = 'red', fill_color = 'Red')\n",
")\n",
"\n",
"map.add_child(featureGroup)\n",
"folium.Marker([56.839234, 60.546997], popup = 'Екатеринбург, в разговорной речи - Екб').add_to(map)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "bf7d4de1",
"metadata": {},
"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;head&gt; \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/[email protected]/dist/leaflet.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://code.jquery.com/jquery-1.12.4.min.js&quot;&gt;&lt;/script&gt;\n",
" &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.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/[email protected]/dist/leaflet.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css&quot;/&gt;\n",
" &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.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_aeec77cfb1d33d306cd8688ca7abbc0d {\n",
" position: relative;\n",
" width: 100.0%;\n",
" height: 100.0%;\n",
" left: 0.0%;\n",
" top: 0.0%;\n",
" }\n",
" &lt;/style&gt;\n",
" \n",
"&lt;/head&gt;\n",
"&lt;body&gt; \n",
" \n",
" &lt;div class=&quot;folium-map&quot; id=&quot;map_aeec77cfb1d33d306cd8688ca7abbc0d&quot; &gt;&lt;/div&gt;\n",
" \n",
"&lt;/body&gt;\n",
"&lt;script&gt; \n",
" \n",
" var map_aeec77cfb1d33d306cd8688ca7abbc0d = L.map(\n",
" &quot;map_aeec77cfb1d33d306cd8688ca7abbc0d&quot;,\n",
" {\n",
" center: [56.839234, 60.546997],\n",
" crs: L.CRS.EPSG3857,\n",
" zoom: 12,\n",
" zoomControl: true,\n",
" preferCanvas: false,\n",
" }\n",
" );\n",
"\n",
" \n",
"\n",
" \n",
" \n",
" var tile_layer_13cc12797ffdfb8c09571c3805655155 = L.tileLayer(\n",
" &quot;https://geoapi.ift.datacloud.t1-cloud.ru/tiller/tile/{z}/{x}/{y}.png?apikey=b019d06a-5de8-41d4-be11-c9778bcb916e&quot;,\n",
" {&quot;attribution&quot;: &quot;INNOTECH&quot;, &quot;detectRetina&quot;: false, &quot;maxNativeZoom&quot;: 18, &quot;maxZoom&quot;: 18, &quot;minZoom&quot;: 0, &quot;noWrap&quot;: false, &quot;opacity&quot;: 1, &quot;subdomains&quot;: &quot;abc&quot;, &quot;tms&quot;: false}\n",
" ).addTo(map_aeec77cfb1d33d306cd8688ca7abbc0d);\n",
" \n",
" \n",
" var feature_group_4d4d77b907533c66932d6234c591059c = L.featureGroup(\n",
" {}\n",
" ).addTo(map_aeec77cfb1d33d306cd8688ca7abbc0d);\n",
" \n",
" \n",
" var circle_marker_60a0ae59f5f81e55f3991bba29bc32e2 = L.circleMarker(\n",
" [56.839234, 60.546997],\n",
" {&quot;bubblingMouseEvents&quot;: true, &quot;color&quot;: &quot;red&quot;, &quot;dashArray&quot;: null, &quot;dashOffset&quot;: null, &quot;fill&quot;: true, &quot;fillColor&quot;: &quot;Red&quot;, &quot;fillOpacity&quot;: 0.2, &quot;fillRule&quot;: &quot;evenodd&quot;, &quot;lineCap&quot;: &quot;round&quot;, &quot;lineJoin&quot;: &quot;round&quot;, &quot;opacity&quot;: 1.0, &quot;radius&quot;: 5, &quot;stroke&quot;: true, &quot;weight&quot;: 3}\n",
" ).addTo(feature_group_4d4d77b907533c66932d6234c591059c);\n",
" \n",
" \n",
" var marker_267c7859597b9a086ebc3dbd785d83dd = L.marker(\n",
" [56.839234, 60.546997],\n",
" {}\n",
" ).addTo(map_aeec77cfb1d33d306cd8688ca7abbc0d);\n",
" \n",
" \n",
" var popup_0c2420ee27bc151a8b08c92e16e9f887 = L.popup({&quot;maxWidth&quot;: &quot;100%&quot;});\n",
"\n",
" \n",
" \n",
" var html_f5b6846fab5e95c696dfe251d389f303 = $(`&lt;div id=&quot;html_f5b6846fab5e95c696dfe251d389f303&quot; style=&quot;width: 100.0%; height: 100.0%;&quot;&gt;Екатеринбург, в разговорной речи - Екб&lt;/div&gt;`)[0];\n",
" popup_0c2420ee27bc151a8b08c92e16e9f887.setContent(html_f5b6846fab5e95c696dfe251d389f303);\n",
" \n",
" \n",
"\n",
" marker_267c7859597b9a086ebc3dbd785d83dd.bindPopup(popup_0c2420ee27bc151a8b08c92e16e9f887)\n",
" ;\n",
"\n",
" \n",
" \n",
"&lt;/script&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 0x16bed61beb0>"
]
},
"execution_count": 25,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"map"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6eaebdba",
"metadata": {},
"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.9.7"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment