{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "0.5.0+27.g2d457b0.dirty\n" ] } ], "source": [ "import os\n", "import folium\n", "\n", "print(folium.__version__)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
" ], "text/plain": [ "" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from folium.features import CustomIcon\n", "\n", "m = folium.Map(location=[45.372, -121.6972], zoom_start=12, tiles='Stamen Terrain')\n", "\n", "url = 'http://leafletjs.com/examples/custom-icons/{}'.format\n", "icon_image = url('leaf-red.png')\n", "shadow_image = url('leaf-shadow.png')\n", "\n", "icon = CustomIcon(\n", " icon_image,\n", " icon_size=(38, 95),\n", " icon_anchor=(22, 94),\n", " shadow_image=shadow_image,\n", " shadow_size=(50, 64),\n", " shadow_anchor=(4, 62),\n", " popup_anchor=(-3, -76)\n", ")\n", "\n", "marker = folium.Marker(\n", " location=[45.3288, -121.6625],\n", " icon=icon,\n", " popup='Mt. Hood Meadows'\n", ")\n", "\n", "\n", "m.add_child(marker)\n", "\n", "m.save(os.path.join('results', 'CustomIcon.html'))\n", "\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.6.2" } }, "nbformat": 4, "nbformat_minor": 1 }