{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## Demo of a Minimap in Folium" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import folium\n", "from folium.plugins import MiniMap" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=4)\n", "\n", "minimap = MiniMap()\n", "m.add_child(minimap)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Make the minimap collapsable" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=4)\n", "minimap = MiniMap(toggle_display=True)\n", "minimap.add_to(m)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Change the minimap tile layer" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=4)\n", "minimap = MiniMap(tile_layer='Stamen Toner')\n", "minimap.add_to(m)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Change the minimap position" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=4)\n", "minimap = MiniMap(position='topleft')\n", "minimap.add_to(m)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Change the minimap size" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 6, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=4)\n", "minimap = MiniMap(width=400, height=100)\n", "minimap.add_to(m)\n", "m" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Change the zoom offset" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "m = folium.Map(location=(30, 20), zoom_start=8)\n", "minimap = MiniMap(zoom_level_offset=-8)\n", "minimap.add_to(m)\n", "m" ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "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.7.1" } }, "nbformat": 4, "nbformat_minor": 2 }